Skip to content

Commit

Permalink
Add !important case to cssom-setProperty-shorthand.html (#11047)
Browse files Browse the repository at this point in the history
Add !important case to cssom-setProperty-shorthand.html
to make sure the property is removed regardless [1].

[1] https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-removeproperty

Change-Id: Ia68d224fb78a13f51bfeda02860932d56b1a0fba
  • Loading branch information
chromium-wpt-export-bot authored and fred-wang committed May 17, 2018
1 parent 43d7898 commit 2eca7cd
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions css/cssom/cssom-setProperty-shorthand.html
Expand Up @@ -42,8 +42,8 @@

element = document.createElement('span');

function canSetProperty(propertyName) {
element.style.setProperty(propertyName, 'initial');
function canSetProperty(propertyName, priority) {
element.style.setProperty(propertyName, 'initial', priority);
return element.style.getPropertyValue(propertyName) == 'initial';
}

Expand All @@ -56,13 +56,21 @@
var propertyName = shorthandProperties[i];

test(function(){
assert_true(canSetProperty(propertyName), 'can setPropertyValue with shorthand');
assert_true(canSetProperty(propertyName, ''), 'can setPropertyValue with shorthand');
}, 'shorthand ' + propertyName + ' can be set with setProperty');

test(function(){
assert_true(canRemoveProperty(propertyName), 'can setPropertyValue with shorthand');
}, 'shorthand ' + propertyName + ' can be removed with removeProperty');

test(function(){
assert_true(canSetProperty(propertyName, 'important'), 'can setPropertyValue with shorthand');
}, 'shorthand ' + propertyName + ' can be set with setProperty and priority !important');

test(function(){
assert_true(canRemoveProperty(propertyName), 'can setPropertyValue with shorthand');
}, 'shorthand ' + propertyName + ' can be removed with removeProperty even when set with !important');

}
</script>
</body>
Expand Down

0 comments on commit 2eca7cd

Please sign in to comment.