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

feat(switch): Restructure DOM #5312

Merged
merged 5 commits into from
Dec 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions packages/mdc-switch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ npm install @material/switch
<div class="mdc-switch">
<div class="mdc-switch__track"></div>
<div class="mdc-switch__thumb-underlay">
<div class="mdc-switch__thumb">
<input type="checkbox" id="basic-switch" class="mdc-switch__native-control" role="switch">
</div>
<div class="mdc-switch__thumb"></div>
<input type="checkbox" id="basic-switch" class="mdc-switch__native-control" role="switch">
</div>
</div>
<label for="basic-switch">off/on</label>
Expand Down Expand Up @@ -78,9 +77,8 @@ Add the `mdc-switch--disabled` class to the `mdc-switch` element, and the `disab
<div class="mdc-switch mdc-switch--disabled">
<div class="mdc-switch__track"></div>
<div class="mdc-switch__thumb-underlay">
<div class="mdc-switch__thumb">
<input type="checkbox" id="another-basic-switch" class="mdc-switch__native-control" role="switch" disabled>
</div>
<div class="mdc-switch__thumb"></div>
<input type="checkbox" id="another-basic-switch" class="mdc-switch__native-control" role="switch" disabled>
</div>
</div>
<label for="another-basic-switch">off/on</label>
Expand All @@ -94,9 +92,8 @@ Add the `mdc-switch--checked` class to the `mdc-switch` element, and the `checke
<div class="mdc-switch mdc-switch--checked">
<div class="mdc-switch__track"></div>
<div class="mdc-switch__thumb-underlay">
<div class="mdc-switch__thumb">
<input type="checkbox" id="another-basic-switch" class="mdc-switch__native-control" role="switch" checked>
</div>
<div class="mdc-switch__thumb"></div>
<input type="checkbox" id="another-basic-switch" class="mdc-switch__native-control" role="switch" checked>
</div>
</div>
<label for="another-basic-switch">off/on</label>
Expand Down
20 changes: 8 additions & 12 deletions test/screenshot/spec/mdc-switch/classes/baseline.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@
<div class="mdc-switch">
<div class="mdc-switch__track"></div>
<div class="mdc-switch__thumb-underlay">
<div class="mdc-switch__thumb">
<input type="checkbox" id="basic-switch-1" class="mdc-switch__native-control" role="switch">
</div>
<div class="mdc-switch__thumb"></div>
<input type="checkbox" id="basic-switch-1" class="mdc-switch__native-control" role="switch">
</div>
</div>
<label class="test-switch-label" for="basic-switch-1">1</label>
Expand All @@ -58,9 +57,8 @@
<div class="mdc-switch mdc-switch--checked">
<div class="mdc-switch__track"></div>
<div class="mdc-switch__thumb-underlay">
<div class="mdc-switch__thumb">
<input type="checkbox" id="basic-switch-2" class="mdc-switch__native-control" role="switch" checked>
</div>
<div class="mdc-switch__thumb"></div>
<input type="checkbox" id="basic-switch-2" class="mdc-switch__native-control" role="switch" checked>
</div>
</div>
<label class="test-switch-label" for="basic-switch-2">2</label>
Expand All @@ -70,9 +68,8 @@
<div class="mdc-switch mdc-switch--disabled">
<div class="mdc-switch__track"></div>
<div class="mdc-switch__thumb-underlay">
<div class="mdc-switch__thumb">
<input type="checkbox" id="basic-switch-3" class="mdc-switch__native-control" role="switch" disabled>
</div>
<div class="mdc-switch__thumb"></div>
<input type="checkbox" id="basic-switch-3" class="mdc-switch__native-control" role="switch" disabled>
</div>
</div>
<label class="test-switch-label" for="basic-switch-3">3</label>
Expand All @@ -82,9 +79,8 @@
<div class="mdc-switch mdc-switch--checked mdc-switch--disabled">
<div class="mdc-switch__track"></div>
<div class="mdc-switch__thumb-underlay">
<div class="mdc-switch__thumb">
<input type="checkbox" id="basic-switch-4" class="mdc-switch__native-control" role="switch" checked disabled>
</div>
<div class="mdc-switch__thumb"></div>
<input type="checkbox" id="basic-switch-4" class="mdc-switch__native-control" role="switch" checked disabled>
</div>
</div>
<label class="test-switch-label" for="basic-switch-4">4</label>
Expand Down
12 changes: 5 additions & 7 deletions test/screenshot/spec/mdc-switch/mixins/density.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@
<div class="mdc-switch custom-switch--density-5">
<div class="mdc-switch__track"></div>
<div class="mdc-switch__thumb-underlay">
<div class="mdc-switch__thumb">
<input type="checkbox" id="basic-switch-1" class="mdc-switch__native-control" role="switch"
data-autofocus>
</div>
<div class="mdc-switch__thumb"></div>
<input type="checkbox" id="basic-switch-1" class="mdc-switch__native-control" role="switch"
data-autofocus>
</div>
</div>
<label class="test-switch-label" for="basic-switch-1">Density -5</label>
Expand All @@ -60,9 +59,8 @@
<div class="mdc-switch custom-switch--density-2">
<div class="mdc-switch__track"></div>
<div class="mdc-switch__thumb-underlay">
<div class="mdc-switch__thumb">
<input type="checkbox" id="basic-switch-2" class="mdc-switch__native-control" role="switch">
</div>
<div class="mdc-switch__thumb"></div>
<input type="checkbox" id="basic-switch-2" class="mdc-switch__native-control" role="switch">
</div>
</div>
<label class="test-switch-label" for="basic-switch-2">Density -2</label>
Expand Down
20 changes: 8 additions & 12 deletions test/screenshot/spec/mdc-switch/mixins/thumb-color.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@
<div class="custom-switch custom-switch--thumb-color mdc-switch">
<div class="mdc-switch__track"></div>
<div class="mdc-switch__thumb-underlay">
<div class="mdc-switch__thumb">
<input type="checkbox" id="basic-switch-1" class="mdc-switch__native-control" role="switch">
</div>
<div class="mdc-switch__thumb"></div>
<input type="checkbox" id="basic-switch-1" class="mdc-switch__native-control" role="switch">
</div>
</div>
<label class="test-switch-label" for="basic-switch-1">1</label>
Expand All @@ -58,9 +57,8 @@
<div class="custom-switch custom-switch--thumb-color mdc-switch mdc-switch--checked">
<div class="mdc-switch__track"></div>
<div class="mdc-switch__thumb-underlay">
<div class="mdc-switch__thumb">
<input type="checkbox" id="basic-switch-2" class="mdc-switch__native-control" role="switch" checked>
</div>
<div class="mdc-switch__thumb"></div>
<input type="checkbox" id="basic-switch-2" class="mdc-switch__native-control" role="switch" checked>
</div>
</div>
<label class="test-switch-label" for="basic-switch-2">2</label>
Expand All @@ -70,9 +68,8 @@
<div class="custom-switch custom-switch--thumb-color mdc-switch mdc-switch--disabled">
<div class="mdc-switch__track"></div>
<div class="mdc-switch__thumb-underlay">
<div class="mdc-switch__thumb">
<input type="checkbox" id="basic-switch-3" class="mdc-switch__native-control" role="switch" disabled>
</div>
<div class="mdc-switch__thumb"></div>
<input type="checkbox" id="basic-switch-3" class="mdc-switch__native-control" role="switch" disabled>
</div>
</div>
<label class="test-switch-label" for="basic-switch-3">3</label>
Expand All @@ -82,9 +79,8 @@
<div class="custom-switch custom-switch--thumb-color mdc-switch mdc-switch--checked mdc-switch--disabled">
<div class="mdc-switch__track"></div>
<div class="mdc-switch__thumb-underlay">
<div class="mdc-switch__thumb">
<input type="checkbox" id="basic-switch-4" class="mdc-switch__native-control" role="switch" checked disabled>
</div>
<div class="mdc-switch__thumb"></div>
<input type="checkbox" id="basic-switch-4" class="mdc-switch__native-control" role="switch" checked disabled>
</div>
</div>
<label class="test-switch-label" for="basic-switch-4">4</label>
Expand Down
20 changes: 8 additions & 12 deletions test/screenshot/spec/mdc-switch/mixins/track-color.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@
<div class="custom-switch custom-switch--track-color mdc-switch">
<div class="mdc-switch__track"></div>
<div class="mdc-switch__thumb-underlay">
<div class="mdc-switch__thumb">
<input type="checkbox" id="basic-switch-1" class="mdc-switch__native-control" role="switch">
</div>
<div class="mdc-switch__thumb"></div>
<input type="checkbox" id="basic-switch-1" class="mdc-switch__native-control" role="switch">
</div>
</div>
<label class="test-switch-label" for="basic-switch-1">1</label>
Expand All @@ -58,9 +57,8 @@
<div class="custom-switch custom-switch--track-color mdc-switch mdc-switch--checked">
<div class="mdc-switch__track"></div>
<div class="mdc-switch__thumb-underlay">
<div class="mdc-switch__thumb">
<input type="checkbox" id="basic-switch-2" class="mdc-switch__native-control" role="switch" checked>
</div>
<div class="mdc-switch__thumb"></div>
<input type="checkbox" id="basic-switch-2" class="mdc-switch__native-control" role="switch" checked>
</div>
</div>
<label class="test-switch-label" for="basic-switch-2">2</label>
Expand All @@ -70,9 +68,8 @@
<div class="custom-switch custom-switch--track-color mdc-switch mdc-switch--disabled">
<div class="mdc-switch__track"></div>
<div class="mdc-switch__thumb-underlay">
<div class="mdc-switch__thumb">
<input type="checkbox" id="basic-switch-3" class="mdc-switch__native-control" role="switch" disabled>
</div>
<div class="mdc-switch__thumb"></div>
<input type="checkbox" id="basic-switch-3" class="mdc-switch__native-control" role="switch" disabled>
</div>
</div>
<label class="test-switch-label" for="basic-switch-3">3</label>
Expand All @@ -82,9 +79,8 @@
<div class="custom-switch custom-switch--track-color mdc-switch mdc-switch--checked mdc-switch--disabled">
<div class="mdc-switch__track"></div>
<div class="mdc-switch__thumb-underlay">
<div class="mdc-switch__thumb">
<input type="checkbox" id="basic-switch-4" class="mdc-switch__native-control" role="switch" checked disabled>
</div>
<div class="mdc-switch__thumb"></div>
<input type="checkbox" id="basic-switch-4" class="mdc-switch__native-control" role="switch" checked disabled>
</div>
</div>
<label class="test-switch-label" for="basic-switch-4">4</label>
Expand Down