OLD | NEW |
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 Loading... |
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 Loading... |
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> |
OLD | NEW |