summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/custom-elements/state/state-css-selector.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/custom-elements/state/state-css-selector.html')
-rw-r--r--testing/web-platform/tests/custom-elements/state/state-css-selector.html26
1 files changed, 26 insertions, 0 deletions
diff --git a/testing/web-platform/tests/custom-elements/state/state-css-selector.html b/testing/web-platform/tests/custom-elements/state/state-css-selector.html
index d29c927223..8ead8d7809 100644
--- a/testing/web-platform/tests/custom-elements/state/state-css-selector.html
+++ b/testing/web-platform/tests/custom-elements/state/state-css-selector.html
@@ -99,6 +99,32 @@
assert_equals(getComputedStyle(mySibling).getPropertyValue('color'), 'rgb(255, 0, 0)');
}, "state selector only applies to has() on given ident");
+ test(function(t) {
+ myCE.elementInternals.states.add('--green');
+ myCE.elementInternals.states.add('--green');
+ myCE.elementInternals.states.add('--green');
+ t.add_cleanup(() => { myCE.elementInternals.states.delete('--green') });
+ assert_true(myCE.elementInternals.states.has('--green'));
+ assert_equals(getComputedStyle(myCE).getPropertyValue('color'), 'rgb(0, 255, 0)');
+ assert_true(myCE.elementInternals.states.delete('--green'));
+ assert_false(myCE.elementInternals.states.has('--green'));
+ assert_equals(getComputedStyle(myCE).getPropertyValue('color'), 'rgb(255, 0, 0)');
+ assert_false(myCE.elementInternals.states.delete('--green'));
+ }, "states added multiple times counts as one");
+
+ test(function(t) {
+ myCE.elementInternals.states.add('--green');
+ myCE.elementInternals.states.add('--foo');
+ t.add_cleanup(() => { myCE.elementInternals.states.clear() });
+ assert_true(myCE.elementInternals.states.has('--green'));
+ assert_true(myCE.elementInternals.states.has('--foo'));
+ assert_equals(getComputedStyle(myCE).getPropertyValue('color'), 'rgb(0, 255, 0)');
+ myCE.elementInternals.states.clear();
+ assert_false(myCE.elementInternals.states.has('--green'));
+ assert_false(myCE.elementInternals.states.has('--foo'));
+ assert_equals(getComputedStyle(myCE).getPropertyValue('color'), 'rgb(255, 0, 0)');
+ }, "style is invalided on clear()");
+
</script>
</body>
</html>