DEV: Add test for load-more (PR #8369)

Follow-up to 3650c64bca2ce6d4012598446e10278d8fdda75e.


You’ve signed the CLA, udan11. Thank you! This pull request is ready for review.

I would prefer a hash, you have to dig to know what are these false true atm, something like:

configureEyeLineBehavior({foo: true, bar: false});

Would be better I think. I also changed the name, because it’s used all the time and not only in tests now, even if you created it for tests, its real goal is to tweak eye line behaviour.

Also I’m wondering if we couldn’t use: Discourse.rootElement to have all of this automatically working?

I think this should work for both cases:

action=(action "loadMore")

and in this case action=loadMore should be enough

might be worth to have a: defaultEyeLineBehavior function to call, so we don’t have to worry about default eyeline behavior changing in the future, which could lead to hard to track side effects.

is it async though? if we don’t use await inside?

do we need all the lines to test the behavior?

This makes sense. I implemented the configureEyeline function.

Regarding the other comment, .position() and .offset() return slightly different results (relative to parent vs document) and I recommend this to be used only during testing.

Thanks, it makes sense!

Calling configureEyeline with no parameter will reset its behaviour.

Nope. :slight_smile:

I significantly simplified the table to keep a single empty tr.

can’t we do:

if (opts) {
    _skipUpdate = opts.skipUpdate;
    _rootElement = opts.rootElement;
} else {
      _skipUpdate = ENV.environment === "test";
    _rootElement = null;

LGTM, nice :+1: