Fix the slotchange WPT test - it previously didn't catch bugs
The slotchange event is fired on slots the first time they receive assignedNodes. This is the case on all browsers. The previous test just checked that *any* slotchange event was fired, which always passed. The conditions being checked could be removed from the tests and they would mostly all pass. With this CL, the assignedNodes() are compared to the expectations, to ensure a pass. The tests that check multiple slots are a bit of a hack, since the slotchange events come asynchronously. But this still seems better than the prior test. Another note: despite documentation [1] saying that the assignedNodes() accessor should return fallback content, it does not. This is also the case for WebKit and Gecko. Further, the prior test strongly implied that 'slotchange' should be fired for changes to the fallback content, but due to the above fact, no such event is fired, since the assignedNodes() value does not change. [1] https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assignedNodes Bug: 1158001 Change-Id: I2ce15d53239f2c9204d1f1633f333897139e337a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2587711 Auto-Submit: Mason Freed <masonfreed@chromium.org> Commit-Queue: Yu Han <yuzhehan@chromium.org> Reviewed-by:Yu Han <yuzhehan@chromium.org> Cr-Commit-Position: refs/heads/master@{#836784}
Showing
Please register or sign in to comment