Index: Tools/GardeningServer/model/tree-status-tests.html |
diff --git a/Tools/GardeningServer/ui/ct-tree-status-tests.html b/Tools/GardeningServer/model/tree-status-tests.html |
similarity index 50% |
copy from Tools/GardeningServer/ui/ct-tree-status-tests.html |
copy to Tools/GardeningServer/model/tree-status-tests.html |
index f14e34a99b590f9d0f06d93606a065d5c23e0a68..314819c71d8c646e449ba20b73083ac70e2f54fb 100644 |
--- a/Tools/GardeningServer/ui/ct-tree-status-tests.html |
+++ b/Tools/GardeningServer/model/tree-status-tests.html |
@@ -4,32 +4,38 @@ Use of this source code is governed by a BSD-style license that can be |
found in the LICENSE file. |
--> |
-<link rel="import" href="ct-tree-status.html"> |
+<link rel="import" href="tree-status.html"> |
<script> |
+ |
(function () { |
-module("ct-tree-status"); |
+module("tree-status"); |
-openTreeJson = { |
- "username": "username@test.org", |
+var openTreeJson = { |
+ "username": "erg@chromium.org", |
+ "date": "2013-10-14 20:22:00.887390", |
"message": "Tree is open", |
- "can_commit_freely": true |
-} |
+ "can_commit_freely": true, |
+ "general_state": "open" |
+}; |
-throttledTreeJson = { |
+var throttledTreeJson = { |
"username": "username@test.org", |
+ "date": "2013-10-14 20:22:00.887390", |
"message": "Tree is throttled just for fun", |
"can_commit_freely": false |
-} |
+}; |
-closedTreeJson = { |
- "username": "username@test.org", |
- "message": "Tree is closed for maintenance", |
- "can_commit_freely": false |
-} |
+var closedTreeJson = { |
+ "username": "ojan@chromium.org", |
+ "date": "2013-10-14 20:32:09.642350", |
+ "message": "Tree is closed", |
+ "can_commit_freely": false, |
+ "general_state": "closed" |
+}; |
-asyncTest("basic", 10, function() { |
+asyncTest("basic", 6, function() { |
var simulator = new NetworkSimulator(); |
simulator.json = function(url) { |
if (url.indexOf('closed') != -1) |
@@ -40,18 +46,11 @@ asyncTest("basic", 10, function() { |
return Promise.resolve(openTreeJson); |
}; |
- var opentree = document.createElement("ct-tree-status"); |
- opentree.project = "open-tree-project"; |
- var throttledtree = document.createElement("ct-tree-status"); |
- throttledtree.project = "throttled-tree-project"; |
- var closedtree = document.createElement("ct-tree-status"); |
- closedtree.project = "closed-tree-project"; |
+ var opentree = new TreeStatus("open-tree-project"); |
+ var throttledtree = new TreeStatus("throttled-tree-project"); |
+ var closedtree = new TreeStatus("closed-tree-project"); |
simulator.runTest(function() { |
- var urlByName = treestatus.urlByName; |
- treestatus.urlByName = function(name) { |
- return "http://" + name + "-status.appspot.com/"; |
- } |
Promise.all([ |
opentree.update().then(function() { |
equal(opentree.status, "open"); |
@@ -63,17 +62,12 @@ asyncTest("basic", 10, function() { |
}), |
closedtree.update().then(function() { |
equal(closedtree.message, |
- "Tree is closed for maintenance by username@test.org"); |
+ "Tree is closed by ojan@chromium.org"); |
equal(closedtree.status, "closed"); |
- equal(closedtree.shadowRoot.querySelector('a').href, treestatus.urlByName('closed-tree-project')); |
}) |
]).then(function() { |
requestAnimationFrame(function() { |
- ok(!opentree.shadowRoot.textContent.has("open-tree-project")); |
- ok(throttledtree.shadowRoot.textContent.has("throttled-tree-project")); |
- ok(closedtree.shadowRoot.textContent.has("closed-tree-project")); |
start(); |
- treestatus.urlByName = urlByName; |
}); |
}); |
}); |