Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix createTestMediaPlayer #2093

Merged
merged 1 commit into from Aug 18, 2015
Merged

Conversation

TakayoshiKochi
Copy link
Member

Some shadow DOM tests use common "testcommon.js" file, which
contains "createTestMediaPlayer()" function which creates fake
media player with shadow roots for tests to use.

The media player assumed that <input> tag can contain some other
tags like <input type="range"><div>...</div></input>, which is not
true. Usually <input> doesn't require its closing tag, thus
the <div> inside <input> becomes just a sibling of the <input>.

The tests which used crateTestMediaPlayer() depended on the
DOM tree structure with the wrong assumption (given above),
so as a 1st step I replaced the <input> with <div tabindex="0">s
so that we keep the tree structure as is while the element is
clickable.

Now the tree structure looks like:

div#player
  input#outside-control (type=checkbox)
  div#player-shadow-host
    #shadow-root
      div#controls
        button.play_button
        div#timeline (used to be <input type=range>)
          div#timeline-shadow-host
            #shadow-root
              div#timeline-slider-thumb
        div#volue-slider-container
          div#volume-slider (used to be <input type=range>)
            div#volume-shadow-host
              #shadow-root
                div#volume-slider-thumb

On the 2nd step, I fixed the test expectations. These tests
(events/event-dispatch/test-001.html and
events/event-retargeting/test-004.html) relied on the fact that
<input> is implemented using user-agent shadow, thus e.g.
a click event on #volume-slider-thumb, will be retargeted
This is no longer true as all elements inside the whole control
is implemented by plain <div>s, and #timeline and #volume-slider
cannot be a shadow boundary. These expectations are adjusted.

Some shadow DOM tests use common "testcommon.js" file, which
contains "createTestMediaPlayer()" function which creates fake
media player with shadow roots for tests to use.

The media player assumed that <input> tag can contain some other
tags like <input type="range"><div>...</div></input>, which is not
true. Usually <input> doesn't require its closing tag, thus
the <div> inside <input> becomes just a sibling of the <input>.

The tests which used crateTestMediaPlayer() depended on the
DOM tree structure with the wrong assumption (given above),
so as a 1st step I replaced the <input> with <div tabindex="0">s
so that we keep the tree structure as is while the element is
clickable.

Now the tree structure looks like:

div#player
  input#outside-control (type=checkbox)
  div#player-shadow-host
    #shadow-root
      div#controls
        button.play_button
        div#timeline (used to be <input type=range>)
          div#timeline-shadow-host
            #shadow-root
              div#timeline-slider-thumb
        div#volue-slider-container
          div#volume-slider (used to be <input type=range>)
            div#volume-shadow-host
              #shadow-root
                div#volume-slider-thumb

On the 2nd step, I fixed the test expectations.  These tests
(events/event-dispatch/test-001.html and
events/event-retargeting/test-004.html) relied on the fact that
<input> is implemented using user-agent shadow, thus e.g.
a click event on #volume-slider-thumb, will be retargeted
This is no longer true as all elements inside the whole control
is implemented by plain <div>s, and #timeline and #volume-slider
cannot be a shadow boundary.  These expectations are adjusted.
@hoppipolla-critic-bot
Copy link

Critic review: https://critic.hoppipolla.co.uk/r/5736

This is an external review system which you may optionally use for the code review of your pull request.

In order to help critic track your changes, please do not make in-place history rewrites (e.g. via git rebase -i or git commit --amend) when updating this pull request.

@TakayoshiKochi
Copy link
Member Author

@hayatoito PTAL

hayatoito added a commit that referenced this pull request Aug 18, 2015
@hayatoito hayatoito merged commit 885ed83 into web-platform-tests:master Aug 18, 2015
@TakayoshiKochi TakayoshiKochi deleted the events branch August 18, 2015 02:41
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.

None yet

4 participants