Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: sky/tests/lowlevel/classlist.sky

Issue 788093003: Add clear() to Element.classList. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/dom/DOMTokenList.idl ('k') | sky/tests/lowlevel/classlist-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <sky> 2 <sky>
3 <import src="../resources/mocha.sky" /> 3 <import src="../resources/mocha.sky" />
4 <import src="../resources/chai.sky" /> 4 <import src="../resources/chai.sky" />
5 <style> 5 <style>
6 div { font-size: 5px; } 6 div { font-size: 5px; }
7 .font-10 { font-size: 10px; } 7 .font-10 { font-size: 10px; }
8 .font-12 { font-size: 12px; } 8 .font-12 { font-size: 12px; }
9 .font-24 { font-size: 24px; } 9 .font-24 { font-size: 24px; }
10 </style> 10 </style>
(...skipping 30 matching lines...) Expand all
41 target.classList.remove("second"); 41 target.classList.remove("second");
42 assert.equal(target.classList.toString(), "first third"); 42 assert.equal(target.classList.toString(), "first third");
43 }); 43 });
44 44
45 it("should remove multiple classes", function() { 45 it("should remove multiple classes", function() {
46 target.classList.add("first", "second", "third"); 46 target.classList.add("first", "second", "third");
47 target.classList.remove("first", "third"); 47 target.classList.remove("first", "third");
48 assert.equal(target.classList.toString(), "second"); 48 assert.equal(target.classList.toString(), "second");
49 }); 49 });
50 50
51 it("should clear all classes", function() {
52 target.classList.add("first");
53 target.classList.add("second");
54 target.classList.clear();
55 assert.equal(target.classList.toString(), "");
56 assert.isFalse(target.hasAttribute("class"));
57 });
58
51 it("should check for classes", function() { 59 it("should check for classes", function() {
52 target.classList.add("first", "second", "third"); 60 target.classList.add("first", "second", "third");
53 assert.isTrue(target.classList.contains("first")); 61 assert.isTrue(target.classList.contains("first"));
54 assert.isTrue(target.classList.contains("second")); 62 assert.isTrue(target.classList.contains("second"));
55 assert.isTrue(target.classList.contains("third")); 63 assert.isTrue(target.classList.contains("third"));
56 target.classList.remove("second"); 64 target.classList.remove("second");
57 assert.isTrue(target.classList.contains("first")); 65 assert.isTrue(target.classList.contains("first"));
58 assert.isFalse(target.classList.contains("second")); 66 assert.isFalse(target.classList.contains("second"));
59 assert.isTrue(target.classList.contains("third")); 67 assert.isTrue(target.classList.contains("third"));
60 }); 68 });
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 target.classList.remove("font-12"); 101 target.classList.remove("font-12");
94 assert.equal(getComputedStyle(target).fontSize, "24px"); 102 assert.equal(getComputedStyle(target).fontSize, "24px");
95 target.classList.remove("font-24"); 103 target.classList.remove("font-24");
96 assert.equal(getComputedStyle(target).fontSize, "10px"); 104 assert.equal(getComputedStyle(target).fontSize, "10px");
97 target.classList.remove("font-10"); 105 target.classList.remove("font-10");
98 assert.equal(getComputedStyle(target).fontSize, "5px"); 106 assert.equal(getComputedStyle(target).fontSize, "5px");
99 }); 107 });
100 }); 108 });
101 </script> 109 </script>
102 </sky> 110 </sky>
OLDNEW
« no previous file with comments | « sky/engine/core/dom/DOMTokenList.idl ('k') | sky/tests/lowlevel/classlist-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698