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

Side by Side Diff: sky/tests/lowlevel/attribute-collection.sky

Issue 922893002: Merge the Sky Engine changes from the SkyDart branch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months 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
OLDNEW
1 <html> 1 <html>
2 <import src="../resources/mocha.sky" />
3 <import src="../resources/chai.sky" />
4 <script> 2 <script>
5 describe("Attribute collection", function() { 3 import "../resources/third_party/unittest/unittest.dart";
4 import "../resources/unit.dart";
5
6 import "dart:sky";
7
8 void main() {
9 initUnit();
10
6 var div; 11 var div;
7 beforeEach(function() { 12 setUp(() {
8 div = document.createElement("div"); 13 div = document.createElement("div");
9 }); 14 });
10 15
11 it("should get by index", function() { 16 test("should get by index", () {
12 div.setAttribute("attr0", "value0"); 17 div.setAttribute("attr0", "value0");
13 div.setAttribute("attr1", "value1"); 18 div.setAttribute("attr1", "value1");
14 var attrs = div.getAttributes(); 19 var attrs = div.getAttributes();
15 assert.equal(attrs.length, 2); 20 expect(attrs.length, equals(2));
16 assert.equal(attrs[0].name, "attr0"); 21 expect(attrs[0].name, equals("attr0"));
17 assert.equal(attrs[0].value, "value0"); 22 expect(attrs[0].value, equals("value0"));
18 assert.equal(attrs[1].name, "attr1"); 23 expect(attrs[1].name, equals("attr1"));
19 assert.equal(attrs[1].value, "value1"); 24 expect(attrs[1].value, equals("value1"));
20 }); 25 });
21 it("should set by name", function() { 26 test("should set by name", () {
22 div.setAttribute("attrName", "value0"); 27 div.setAttribute("attrName", "value0");
23 assert.equal(div.getAttribute("attrName"), "value0"); 28 expect(div.getAttribute("attrName"), equals("value0"));
24 assert.equal(div.getAttributes()[0].name, "attrName"); 29 expect(div.getAttributes()[0].name, equals("attrName"));
25 assert.equal(div.getAttributes()[0].value, "value0"); 30 expect(div.getAttributes()[0].value, equals("value0"));
26 div.setAttribute("attrName", "new value"); 31 div.setAttribute("attrName", "new value");
27 assert.equal(div.getAttribute("attrName"), "new value"); 32 expect(div.getAttribute("attrName"), equals("new value"));
28 assert.equal(div.getAttributes()[0].name, "attrName"); 33 expect(div.getAttributes()[0].name, equals("attrName"));
29 assert.equal(div.getAttributes()[0].value, "new value"); 34 expect(div.getAttributes()[0].value, equals("new value"));
30 }); 35 });
31 it("should be case sensitive", function() { 36 test("should be case sensitive", () {
32 div.setAttribute("attrName", "value0"); 37 div.setAttribute("attrName", "value0");
33 assert.isNull(div.getAttribute("attrname")); 38 expect(div.getAttribute("attrname"), isNull);
34 assert.equal(div.getAttribute("attrName"), "value0"); 39 expect(div.getAttribute("attrName"), equals("value0"));
35 }); 40 });
36 it("should not live update", function() { 41 test("should not live update", () {
37 div.setAttribute("attr0", "0"); 42 div.setAttribute("attr0", "0");
38 div.setAttribute("attr1", "1"); 43 div.setAttribute("attr1", "1");
39 div.setAttribute("attr2", "2"); 44 div.setAttribute("attr2", "2");
40 var oldAttributes = div.getAttributes(); 45 var oldAttributes = div.getAttributes();
41 assert.equal(oldAttributes.length, 3); 46 expect(oldAttributes.length, equals(3));
42 div.removeAttribute("attr1"); 47 div.removeAttribute("attr1");
43 assert.equal(oldAttributes.length, 3); 48 expect(oldAttributes.length, equals(3));
44 div.setAttribute("attr0", "value0"); 49 div.setAttribute("attr0", "value0");
45 div.setAttribute("attr2", "value2"); 50 div.setAttribute("attr2", "value2");
46 var newAttributes = div.getAttributes(); 51 var newAttributes = div.getAttributes();
47 assert.equal(newAttributes.length, 2); 52 expect(newAttributes.length, equals(2));
48 assert.equal(newAttributes[0].name, "attr0"); 53 expect(newAttributes[0].name, equals("attr0"));
49 assert.equal(newAttributes[0].value, "value0"); 54 expect(newAttributes[0].value, equals("value0"));
50 assert.equal(newAttributes[1].name, "attr2"); 55 expect(newAttributes[1].name, equals("attr2"));
51 assert.equal(newAttributes[1].value, "value2"); 56 expect(newAttributes[1].value, equals("value2"));
52 assert.notEqual(newAttributes, oldAttributes); 57 expect(newAttributes, isNot(equals(oldAttributes)));
53 assert.equal(oldAttributes[0].name, "attr0"); 58 expect(oldAttributes[0].name, equals("attr0"));
54 assert.equal(oldAttributes[0].value, "0"); 59 expect(oldAttributes[0].value, equals("0"));
55 assert.equal(oldAttributes[1].name, "attr1"); 60 expect(oldAttributes[1].name, equals("attr1"));
56 assert.equal(oldAttributes[1].value, "1"); 61 expect(oldAttributes[1].value, equals("1"));
57 assert.equal(oldAttributes[2].name, "attr2"); 62 expect(oldAttributes[2].name, equals("attr2"));
58 assert.equal(oldAttributes[2].value, "2"); 63 expect(oldAttributes[2].value, equals("2"));
59 }); 64 });
60 }); 65 }
61 </script> 66 </script>
62 </html> 67 </html>
OLDNEW
« no previous file with comments | « sky/tests/layout/document-elementFromPoint-expected.txt ('k') | sky/tests/lowlevel/attribute-collection-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698