OLD | NEW |
1 <!-- | 1 <!-- |
2 Copyright 2014 The Chromium Authors. All rights reserved. | 2 Copyright 2014 The Chromium Authors. All rights reserved. |
3 Use of this source code is governed by a BSD-style license that can be | 3 Use of this source code is governed by a BSD-style license that can be |
4 found in the LICENSE file. | 4 found in the LICENSE file. |
5 --> | 5 --> |
6 | 6 |
7 <link rel="import" href="ct-tree-status.html"> | 7 <link rel="import" href="ct-tree-status.html"> |
8 | 8 |
9 <script> | 9 <script> |
10 (function () { | 10 (function () { |
(...skipping 30 matching lines...) Expand all Loading... |
41 }; | 41 }; |
42 | 42 |
43 var opentree = document.createElement("ct-tree-status"); | 43 var opentree = document.createElement("ct-tree-status"); |
44 opentree.project = "open-tree-project"; | 44 opentree.project = "open-tree-project"; |
45 var throttledtree = document.createElement("ct-tree-status"); | 45 var throttledtree = document.createElement("ct-tree-status"); |
46 throttledtree.project = "throttled-tree-project"; | 46 throttledtree.project = "throttled-tree-project"; |
47 var closedtree = document.createElement("ct-tree-status"); | 47 var closedtree = document.createElement("ct-tree-status"); |
48 closedtree.project = "closed-tree-project"; | 48 closedtree.project = "closed-tree-project"; |
49 | 49 |
50 simulator.runTest(function() { | 50 simulator.runTest(function() { |
51 var urlByName = treestatus.urlByName; | 51 var urlByName = TreeStatus.prototype.urlByName; |
52 treestatus.urlByName = function(name) { | 52 TreeStatus.prototype.urlByName = function(name) { |
53 return "http://" + name + "-status.appspot.com/"; | 53 return "http://" + name + "-status.appspot.com/"; |
54 } | 54 } |
55 Promise.all([ | 55 Promise.all([ |
56 opentree.update().then(function() { | 56 opentree.update().then(function() { |
57 equal(opentree.status, "open"); | 57 equal(opentree.status, "open"); |
58 }), | 58 }), |
59 throttledtree.update().then(function() { | 59 throttledtree.update().then(function() { |
60 equal(throttledtree.message, | 60 equal(throttledtree.message, |
61 "Tree is throttled just for fun by username@test.org"); | 61 "Tree is throttled just for fun by username@test.org"); |
62 equal(throttledtree.status, "throttled"); | 62 equal(throttledtree.status, "throttled"); |
63 }), | 63 }), |
64 closedtree.update().then(function() { | 64 closedtree.update().then(function() { |
65 equal(closedtree.message, | 65 equal(closedtree.message, |
66 "Tree is closed for maintenance by username@test.org"); | 66 "Tree is closed for maintenance by username@test.org"); |
67 equal(closedtree.status, "closed"); | 67 equal(closedtree.status, "closed"); |
68 equal(closedtree.shadowRoot.querySelector('a').href, treestatus.urlByNam
e('closed-tree-project')); | 68 |
| 69 var treeStatus = new TreeStatus(); |
| 70 equal(closedtree.shadowRoot.querySelector('a').href, treeStatus.urlByNam
e('closed-tree-project')); |
69 }) | 71 }) |
70 ]).then(function() { | 72 ]).then(function() { |
71 requestAnimationFrame(function() { | 73 requestAnimationFrame(function() { |
72 ok(!opentree.shadowRoot.textContent.has("open-tree-project")); | 74 ok(!opentree.shadowRoot.textContent.has("open-tree-project")); |
73 ok(throttledtree.shadowRoot.textContent.has("throttled-tree-project")); | 75 ok(throttledtree.shadowRoot.textContent.has("throttled-tree-project")); |
74 ok(closedtree.shadowRoot.textContent.has("closed-tree-project")); | 76 ok(closedtree.shadowRoot.textContent.has("closed-tree-project")); |
75 start(); | 77 start(); |
76 treestatus.urlByName = urlByName; | 78 TreeStatus.prototype.urlByName = urlByName; |
77 }); | 79 }); |
78 }); | 80 }); |
79 }); | 81 }); |
80 }); | 82 }); |
81 | 83 |
82 })(); | 84 })(); |
83 </script> | 85 </script> |
OLD | NEW |