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

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

Issue 685623002: Move the tests from .html to .sky (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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/tests/lowlevel/abarth.sky ('k') | sky/tests/lowlevel/attribute-collection.sky » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <html>
2 <link rel="import" href="../resources/mocha.html" />
3 <link rel="import" href="../resources/chai.html" />
4 <script>
5 describe("Attribute collection", function() {
6 var div;
7 beforeEach(function() {
8 div = document.createElement("div");
9 });
10
11 it("should get by index", function() {
12 div.setAttribute("attr0", "value0");
13 div.setAttribute("attr1", "value1");
14 assert.equal(div.attributes.length, 2);
15 assert.equal(div.attributes[0].name, "attr0");
16 assert.equal(div.attributes[0].value, "value0");
17 assert.equal(div.attributes[1].name, "attr1");
18 assert.equal(div.attributes[1].value, "value1");
19 });
20 it("should get by name", function() {
21 div.setAttribute("attr0", "value0");
22 div.setAttribute("attr1", "value1");
23 assert.equal(div.attributes.length, 2);
24 assert.equal(div.attributes.attr0.value, "value0");
25 assert.equal(div.attributes.attr1.value, "value1");
26 });
27 it("should set by name", function() {
28 div.setAttribute("attrName", "value0");
29 div.attributes.attrName.value = "new value";
30 assert.equal(div.getAttribute("attrName"), "new value");
31 assert.equal(div.attributes.attrName.value, "new value");
32 });
33 it("should be case sensitive", function() {
34 div.setAttribute("attrName", "value0");
35 assert.isUndefined(div.attributes.attrname);
36 assert.ok(div.attributes.attrName);
37 assert.equal(div.attributes.attrName.value, "value0");
38 });
39 it("should live update", function() {
40 div.setAttribute("attr0", "");
41 div.setAttribute("attr1", "");
42 div.setAttribute("attr2", "");
43 assert.equal(div.attributes.length, 3);
44 div.removeAttribute("attr1");
45 assert.equal(div.attributes.length, 2);
46 assert.equal(div.attributes[0].name, "attr0");
47 assert.equal(div.attributes[1].name, "attr2");
48 div.setAttribute("attr3", "");
49 div.setAttribute("attr2", "value2");
50 assert.equal(div.attributes.length, 3);
51 assert.equal(div.attributes[2].name, "attr3");
52 assert.equal(div.attributes.attr2.value, "value2");
53 });
54 });
55 </script>
56 </html>
OLDNEW
« no previous file with comments | « sky/tests/lowlevel/abarth.sky ('k') | sky/tests/lowlevel/attribute-collection.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698