Closed Bug 1663793 Opened 4 years ago Closed 4 years ago

Split and isolate every chunk in `test_dom_input_event_on_htmleditor.html` and `test_dom_input_event_on_texteditor.html`

Categories

(Core :: DOM: Editor, task, P3)

task

Tracking

()

RESOLVED FIXED
84 Branch
Tracking Status
firefox84 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

Details

Attachments

(7 files)

Those tests run basic features of HTMLEditor and TextEditor, but as you know, those editor classes are too big so that the there are a lot of tests. And some tests depend on previous test result and isolated chunks may not reset everything.

So, I think that each chunk should be encapsulated into a function, and reset function should take an object to reset all things with preferred value.

Severity: -- → N/A
Priority: -- → P3
Assignee: nobody → masayuki
Status: NEW → ASSIGNED

Indent level of the tests will be increased. Therefore, all descriptions
should be in their own lines.

Note that this and following patches rewrite almost all lines in the test
files again and again. Therefore, it's hard to rebase and existing bugs
will be fixed when I was writing each patch. So, I'd like reviewers just
put inline comment which should be fixed before landing. Then, I'll add
a patch to fix them.

Although, still there are dependencies between the functions, this allows
stack has meaningful name where a failure occurs.

Depends on D94515

So, this removes functions named as *_and_canceling_beforeinput and
makes corresponding function take an object which has action and
cancelBeforeInput to reduce dependency on wider scope variables.

Depends on D94516

This allows the following patches will make all functions use batch function
to test with a framework.

Depends on D94517

This patch makes all test functions call runTest() and it adds event listeners
only while running the function. Therefore, this makes each test function do:

  • initializing for running test
  • running test with runTest and specifying expected data

Depends on D94519

When beforeinput event is canceled, the editor content shouldn't be modified.
Therefore, runTest() can handle it with caching initial value before
running the test body.

Additionally, this patch makes every test ensure that target editor has focus.
So, finally, each test is now isolated completely. Developers can run only
a test with commenting out the other tests.

Depends on D94520

Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/4cc1e99c7265
part 1: Make sure description of `ok()`, `is()`, etc. have its own line r=m_kato
https://hg.mozilla.org/integration/autoland/rev/8e0f42721cd7
part 2: Split each chunk into IIFE r=m_kato
https://hg.mozilla.org/integration/autoland/rev/12f9e5ca5023
part 3: Use same function to check canceling "beforeinput" and not canceling it r=m_kato
https://hg.mozilla.org/integration/autoland/rev/5363016dd24f
part 4: Make all test functions take an object for consistency r=m_kato
https://hg.mozilla.org/integration/autoland/rev/0325dbe8ce79
part 5: Create a common method to check editor content, beforeinput event and input event r=m_kato
https://hg.mozilla.org/integration/autoland/rev/fd5b832857ba
part 6: Encapsulate all variables interacting with event listeners into a function r=m_kato
https://hg.mozilla.org/integration/autoland/rev/85bcbc051959
part 7: Make `runTest()` automatically handle editor value check in the case canceling `beforeinput` r=m_kato
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: