OLD | NEW |
| (Empty) |
1 <!-- | |
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 | |
4 found in the LICENSE file. | |
5 --> | |
6 | |
7 <link rel="import" href="../ct-view.html"> | |
8 | |
9 <script> | |
10 (function () { | |
11 | |
12 var assert = chai.assert; | |
13 | |
14 describe('ct-view', function() { | |
15 var view; | |
16 | |
17 beforeEach(function() { | |
18 view = document.createElement('ct-view'); | |
19 view.appendChild(document.createElement('div')); | |
20 }); | |
21 | |
22 it('should match path', function(done) { | |
23 view.path = "/test/path"; | |
24 setTimeout(function() { | |
25 var div = view.showView("/test/path"); | |
26 assert.ok(div); | |
27 assert(!div.hidden); | |
28 | |
29 done(); | |
30 }); | |
31 }); | |
32 | |
33 it('should not match incorrect path', function(done) { | |
34 view.path = "/other/path"; | |
35 setTimeout(function() { | |
36 var div = view.showView("/test/path"); | |
37 assert.notOk(div); | |
38 | |
39 done(); | |
40 }); | |
41 }); | |
42 | |
43 it('should assign variables to child', function(done) { | |
44 view.path = "/{var1}/test/{var2}"; | |
45 setTimeout(function() { | |
46 var div = view.showView("/value1/test/value2"); | |
47 assert.ok(div); | |
48 assert.equal(div.getAttribute('var1'), 'value1'); | |
49 assert.equal(div.getAttribute('var2'), 'value2'); | |
50 | |
51 done(); | |
52 }); | |
53 }); | |
54 | |
55 }); | |
56 | |
57 })(); | |
58 </script> | |
OLD | NEW |