Skip to content

Add shadowdom-customelements tests - #5705

Merged
hayatoito merged 4 commits into
web-platform-tests:masterfrom
surma-dump:shadowdom-customelements
Jul 12, 2017
Merged

hayatoito merged 4 commits into
web-platform-tests:masterfrom
surma-dump:shadowdom-customelements

Conversation

@surma

@surma surma commented Apr 26, 2017 •

Copy link
Copy Markdown
Contributor

This is pending consensus on whatwg/dom#447

This is my first platform test, so please review and let me know what to improve :)

@wpt-pr-bot

Copy link
Copy Markdown
Collaborator

this.shadowRoot.innerHTML = '<slot></slot>';
var slot = this.shadowRoot.children[0];
slot.addEventListener('slotchange', function() {
calls.push(this);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be better as calls.push(this.id). Then below you can do a single test, something like assert_array_equals(calls, ["upgrade", "parser"]). That has the bonus of testing that things are in the correct order.

@ghost

ghost commented Apr 26, 2017 •

Copy link
Copy Markdown

View the complete job log.

Lint

Passed

@ghost

ghost commented Apr 26, 2017 •

Copy link
Copy Markdown

View the complete job log.

Firefox (nightly channel)

Testing web-platform-tests at revision f8caaa4
Using browser at version BuildID 20170426100344; SourceStamp 0f5ba06c4c5959030a05cb852656d854065e2226
Starting 10 test iterations
All results were stable

All results

1 test ran
/shadow-dom/slotchange-customelements.html
Subtest Results Messages
OK
slotchange must fire on initialization of custom elements with slotted children FAIL assert_array_equals: lengths differ, expected 2 got 0

@ghost

ghost commented Apr 26, 2017 •

Copy link
Copy Markdown

View the complete job log.

Chrome (unstable channel)

Testing web-platform-tests at revision f8caaa4
Using browser at version 59.0.3071.25 dev
Starting 10 test iterations
All results were stable

All results

1 test ran
/shadow-dom/slotchange-customelements.html
Subtest Results Messages
OK
slotchange must fire on initialization of custom elements with slotted children FAIL assert_array_equals: lengths differ, expected 2 got 1

@ghost

ghost commented Apr 26, 2017

Copy link
Copy Markdown

These tests are now available on w3c-test.org

@surma

surma commented May 11, 2017

Copy link
Copy Markdown
Contributor Author

I adjusted the tests to capture the new findings in whatwg/dom#447. I.e. the tests now ensure that the behavior is the same regardless of whether slots are created in the constructor or connectedCallback.

@domenic You mind taking another look if this is still appropriate?

@ghost

ghost commented May 11, 2017 •

Copy link
Copy Markdown

View the complete job log.

Firefox (nightly)

Testing web-platform-tests at revision 211f2b1
Using browser at version BuildID 20170510183715; SourceStamp ce2218406119c36a551e3faea4e192186ee46cc5
Starting 10 test iterations
All results were stable

All results

1 test ran
/shadow-dom/slotchange-customelements.html
Subtest Results Messages
OK
slotchange must fire on initialization of custom elements with slotted children FAIL assert_array_equals: lengths differ, expected 4 got 0

@ghost

ghost commented May 11, 2017 •

Copy link
Copy Markdown

View the complete job log.

Chrome (unstable)

Testing web-platform-tests at revision 211f2b1
Using browser at version 60.0.3088.3 dev
Starting 10 test iterations
All results were stable

All results

1 test ran
/shadow-dom/slotchange-customelements.html
Subtest Results Messages
OK
slotchange must fire on initialization of custom elements with slotted children FAIL assert_array_equals: lengths differ, expected 4 got 2

@domenic

domenic commented May 31, 2017

Copy link
Copy Markdown
Member

@surma sorry for disappearing on this. Is it OK if I turn this over to @hayatoito as the reviewer? I understand he is also looking into other web platform test changes for this spec change.

@surma

surma commented May 31, 2017

Copy link
Copy Markdown
Contributor Author

Absolutely fine by me :)

@hayatoito

Copy link
Copy Markdown
Member

Sure. I'll take a look.

@hayatoito

Copy link
Copy Markdown
Member

I'll review this PR after whatwg/dom#459 is merged.

<slots-in-callback id="callback-parser"><div></div></slots-in-callback>
<script>
test(function () {
assert_array_equals(calls, ["constructor-parser", "callback-parser", "constructor-upgrade", "callback-upgrade"]);

@hayatoito hayatoito Jul 5, 2017 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be:

    assert_array_equals(calls, ["constructor-upgrade", "callback-upgrade", "constructor-parser", "callback-parser"]);

That matches the current behavior of Blink.
If we want to avoid to depend on the microtask execution order, it might be better to use different calls-ish variables or something, instead of using one calls variable for all.

@surma surma Jul 10, 2017 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. I will separate this into two tests (as it was a couple of commits before)

@surma

surma commented Jul 10, 2017

Copy link
Copy Markdown
Contributor Author

@hayatoito Took a slightly different path than I thought I would. PTAL :)

@hayatoito
hayatoito self-requested a review July 12, 2017 06:50
@hayatoito
hayatoito merged commit 5f8b267 into web-platform-tests:master Jul 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants