From feddb52e59eed4137b943db45c4487020aa5e5ec Mon Sep 17 00:00:00 2001 From: Sankha Narayan Guria Date: Sat, 14 Nov 2015 14:15:24 +0530 Subject: [PATCH] Test that any call to classList.add() create the class attribute --- .../web-platform-tests/dom/nodes/Element-classlist.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/wpt/web-platform-tests/dom/nodes/Element-classlist.html b/tests/wpt/web-platform-tests/dom/nodes/Element-classlist.html index 92412425103..9c0ff05efd9 100644 --- a/tests/wpt/web-platform-tests/dom/nodes/Element-classlist.html +++ b/tests/wpt/web-platform-tests/dom/nodes/Element-classlist.html @@ -245,6 +245,13 @@ test(function () { WebIDL creates actual OwnProperties and then [] just acts as a normal property lookup */ assert_equals( elem.classList[0], undefined ); }, 'classList[0] must be undefined when all classes have been removed'); +test(function () { + var foo = document.createElement('div'); + foo.classList.add(); + assert_true( foo.hasAttribute('class') ); + assert_equals( foo.classList + '', '', 'implicit' ); + assert_equals( foo.classList.toString(), '', 'explicit' ); +}, 'Invoking add or remove should set the class attribute'); // The ordered set parser must skip ASCII whitespace (U+0009, U+000A, U+000C, U+000D, and U+0020.) test(function () { var foo = document.createElement('div');