OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 (function() { | 5 (function() { |
6 | 6 |
7 'use strict'; | 7 'use strict'; |
8 | 8 |
9 var onShow = null; | 9 var onShow = null; |
10 var onHide = null; | 10 var onHide = null; |
(...skipping 25 matching lines...) Expand all Loading... | |
36 test('should display on click', function() { | 36 test('should display on click', function() { |
37 var menu = menuButton.menu(); | 37 var menu = menuButton.menu(); |
38 ok(menu.offsetWidth == 0 && menu.offsetHeight == 0); | 38 ok(menu.offsetWidth == 0 && menu.offsetHeight == 0); |
39 menuButton.button().click(); | 39 menuButton.button().click(); |
40 ok(menu.offsetWidth != 0 && menu.offsetHeight != 0); | 40 ok(menu.offsetWidth != 0 && menu.offsetHeight != 0); |
41 }); | 41 }); |
42 | 42 |
43 test('should dismiss when <body> is clicked', function() { | 43 test('should dismiss when <body> is clicked', function() { |
44 var menu = menuButton.menu(); | 44 var menu = menuButton.menu(); |
45 menuButton.button().click(); | 45 menuButton.button().click(); |
46 document.body.click(); | 46 document.body.click(); |
Wez
2014/09/23 16:36:49
It's unfortunate that this test passed even though
Jamie
2014/09/23 21:06:34
Good catch! This test was passing previously becau
| |
47 ok(menu.offsetWidth == 0 && menu.offsetHeight == 0); | 47 ok(menu.offsetWidth == 0 && menu.offsetHeight == 0); |
48 }); | 48 }); |
49 | 49 |
50 /* | |
51 TODO(jamiewalch): Reinstate this once MenuButton is fixed properly. | |
52 test('should dismiss when button is clicked', function() { | 50 test('should dismiss when button is clicked', function() { |
53 var menu = menuButton.menu(); | 51 var menu = menuButton.menu(); |
54 menuButton.button().click(); | 52 menuButton.button().click(); |
55 menuButton.button().click(); | 53 menuButton.button().click(); |
56 ok(menu.offsetWidth == 0 && menu.offsetHeight == 0); | 54 ok(menu.offsetWidth == 0 && menu.offsetHeight == 0); |
57 }); | 55 }); |
58 */ | |
59 | 56 |
60 test('should dismiss when menu item is clicked', function() { | 57 test('should dismiss when menu item is clicked', function() { |
61 var menu = menuButton.menu(); | 58 var menu = menuButton.menu(); |
62 menuButton.button().click(); | 59 menuButton.button().click(); |
63 var element = document.getElementById('menu-option-1'); | 60 var element = document.getElementById('menu-option-1'); |
64 element.click(); | 61 element.click(); |
65 ok(menu.offsetWidth == 0 && menu.offsetHeight == 0); | 62 ok(menu.offsetWidth == 0 && menu.offsetHeight == 0); |
66 }); | 63 }); |
67 | 64 |
68 test('should invoke callbacks', function() { | 65 test('should invoke callbacks', function() { |
(...skipping 11 matching lines...) Expand all Loading... | |
80 ok(style.backgroundImage == 'none'); | 77 ok(style.backgroundImage == 'none'); |
81 remoting.MenuButton.select(element, true); | 78 remoting.MenuButton.select(element, true); |
82 style = window.getComputedStyle(element); | 79 style = window.getComputedStyle(element); |
83 ok(style.backgroundImage != 'none'); | 80 ok(style.backgroundImage != 'none'); |
84 remoting.MenuButton.select(element, false); | 81 remoting.MenuButton.select(element, false); |
85 style = window.getComputedStyle(element); | 82 style = window.getComputedStyle(element); |
86 ok(style.backgroundImage == 'none'); | 83 ok(style.backgroundImage == 'none'); |
87 }); | 84 }); |
88 | 85 |
89 }()); | 86 }()); |
OLD | NEW |