aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/test
diff options
context:
space:
mode:
authorValerio Virgillito2012-04-18 13:48:51 -0700
committerValerio Virgillito2012-04-18 13:48:51 -0700
commit2e04af953463643791f6362bd8ef4c6ba190abfa (patch)
treed07aaf646091ddf9dad5b030a7905055fd323490 /node_modules/montage/test
parent616a8532099fec2a15855eac97cd85cb60c4451c (diff)
downloadninja-2e04af953463643791f6362bd8ef4c6ba190abfa.tar.gz
Squashed commit of the following:
commit 2054551bfb01a0f4ca2e138b9d724835462d45cd Merge: 765c2da 616a853 Author: Valerio Virgillito <valerio@motorola.com> Date: Wed Apr 18 13:48:21 2012 -0700 Merge branch 'refs/heads/master' into integration commit 765c2da8e1aa03550caf42b2bd5f367555ad2843 Author: Valerio Virgillito <valerio@motorola.com> Date: Tue Apr 17 15:29:41 2012 -0700 updating the picasa carousel Signed-off-by: Valerio Virgillito <valerio@motorola.com> commit 9484f1c82b81e27edf2dc0a1bcc1fa3b12077406 Merge: d27f2df cacb4a2 Author: Valerio Virgillito <valerio@motorola.com> Date: Tue Apr 17 15:03:50 2012 -0700 Merge branch 'refs/heads/master' into integration commit d27f2df4d846064444263d7832d213535962abe7 Author: Valerio Virgillito <valerio@motorola.com> Date: Wed Apr 11 10:39:36 2012 -0700 integrating new picasa carousel component Signed-off-by: Valerio Virgillito <valerio@motorola.com> commit 6f98384c9ecbc8abe55ccfe1fc25a0c7ce22c493 Author: Valerio Virgillito <valerio@motorola.com> Date: Tue Apr 10 14:33:00 2012 -0700 fixed the text area case issue Text area was renamed from TextArea to Textarea Signed-off-by: Valerio Virgillito <valerio@motorola.com> commit 1e83e26652266136802bc7af930379c1ecd631a6 Author: Valerio Virgillito <valerio@motorola.com> Date: Mon Apr 9 22:10:45 2012 -0700 integrating montage v0.8 into ninja. Signed-off-by: Valerio Virgillito <valerio@motorola.com> Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'node_modules/montage/test')
-rwxr-xr-xnode_modules/montage/test/ui/youtube-player-spec.js363
-rw-r--r--node_modules/montage/test/ui/youtube-player-test/youtube-player-test.html47
-rwxr-xr-xnode_modules/montage/test/ui/youtube-player-test/youtube-player-test.js9
3 files changed, 0 insertions, 419 deletions
diff --git a/node_modules/montage/test/ui/youtube-player-spec.js b/node_modules/montage/test/ui/youtube-player-spec.js
deleted file mode 100755
index dc57e3ec..00000000
--- a/node_modules/montage/test/ui/youtube-player-spec.js
+++ /dev/null
@@ -1,363 +0,0 @@
1/* <copyright>
2 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */
6var Montage = require("montage").Montage,
7 TestPageLoader = require("support/testpageloader").TestPageLoader;
8
9var testPage = TestPageLoader.queueTest("buttontest", function() {
10 var test = testPage.test;
11
12 var click = function(component, el, fn) {
13 el = el || component.element;
14
15 var listener = testPage.addListener(component, fn);
16
17 testPage.mouseEvent({target: el}, "mousedown");
18 testPage.mouseEvent({target: el}, "mouseup");
19 testPage.mouseEvent({target: el}, "click");
20
21 // Return this so that it can be checked in tha calling function.
22 return listener;
23 };
24 var testButton = function(component, value) {
25 expect(component).toBeDefined();
26 expect(click(component)).toHaveBeenCalled();
27 expect(component.label).toBe(value);
28 };
29
30 describe("ui/button-spec", function() {
31 it("should load", function() {
32 expect(testPage.loaded).toBe(true);
33 });
34
35 describe("button", function(){
36
37 it("can be created from a div element", function(){
38 testButton(test.divbutton, "div button");
39 });
40 it("can be created from an input element", function(){
41 testButton(test.inputbutton, "input button");
42 });
43 it("can be created from a button element", function(){
44 testButton(test.buttonbutton, "button button");
45 });
46
47 describe("disabled property", function(){
48 it("is taken from the element's disabled attribute", function() {
49 expect(test.disabledbutton.disabled).toBe(true);
50 expect(click(test.disabledbutton)).not.toHaveBeenCalled();
51 expect(test.disabledinput.disabled).toBe(true);
52 expect(click(test.disabledinput)).not.toHaveBeenCalled();
53 expect(test.inputbutton.disabled).toBe(false);
54 });
55 it("can be set", function(){
56 expect(test.disabledbutton.disabled).toBe(true);
57 test.disabledbutton.disabled = false;
58 expect(test.disabledbutton.disabled).toBe(false);
59 // TODO click the button and check that it wasn't pressed
60
61 expect(test.disabledinput.disabled).toBe(true);
62 test.disabledinput.disabled = false;
63 expect(test.disabledinput.disabled).toBe(false);
64 // TODO click the button and check that it wasn't pressed
65 });
66 it("can can be set in the serialization", function(){
67 expect(test.disabledinputszn.disabled).toBe(true);
68 // TODO check button pressibility
69 });
70 it("is the inverse of the enabled property", function(){
71 expect(test.enabledinputszn.disabled).toBe(false);
72 expect(test.enabledinputszn.enabled).toBe(true);
73 test.enabledinputszn.enabled = false;
74 expect(test.enabledinputszn.disabled).toBe(true);
75 expect(test.enabledinputszn.enabled).toBe(false);
76 // TODO click the button and check that it wasn't pressed
77 });
78 });
79
80 describe("label property", function() {
81 it("is set from the serialization on a button", function() {
82 expect(test.buttonlabelszn.label).toBe("pass");
83 testPage.waitForDraw();
84 runs(function(){
85 expect(test.buttonlabelszn.element.firstChild.data).toBe("pass");
86 });
87 });
88 it("is set from the serialization on an input", function() {
89 expect(test.inputlabelszn.label).toBe("pass");
90 expect(test.inputlabelszn.element.value).toBe("pass");
91 });
92 it("sets the value on an input", function() {
93 expect(test.inputbutton.label).toBe("input button");
94 test.inputbutton.label = "label pass";
95 expect(test.inputbutton.label).toBe("label pass");
96 expect(test.inputbutton.value).toBe("label pass");
97 test.inputbutton.label = "input button";
98 });
99 it("sets the first child on a non-input element", function() {
100 expect(test.buttonbutton.label).toBe("button button");
101 test.buttonbutton.label = "label pass";
102 expect(test.buttonbutton.label).toBe("label pass");
103
104 testPage.waitForDraw();
105 runs(function(){
106 expect(test.buttonbutton.element.firstChild.data).toBe("label pass");
107 test.buttonbutton.label = "button button";
108 });
109 });
110 });
111
112 describe("value property", function() {
113 it("is set from the value on an input", function() {
114 expect(test.inputbutton.element.value).toBe("input button");
115 expect(test.inputbutton.value).toBe("input button");
116 });
117 it("is set by the label property in the serialization", function() {
118 expect(test.inputlabelszn.label).toBe("pass");
119 //expect(test.inputlabelszn.value).toBe("pass");
120 });
121 it("sets the label property when using an input element", function() {
122 expect(test.inputbutton.label).toBe("input button");
123 test.inputbutton.value = "value pass";
124 expect(test.inputbutton.value).toBe("value pass");
125 expect(test.inputbutton.label).toBe("value pass");
126 test.inputbutton.value = "input button";
127 });
128 it("doesn't set the label property when using a non-input element", function() {
129 expect(test.buttonbutton.label).toBe("button button");
130 test.buttonbutton.value = "value fail";
131 expect(test.buttonbutton.label).toBe("button button");
132 testPage.waitForDraw();
133 runs(function(){
134 expect(test.buttonbutton.element.firstChild.data).toBe("button button");
135 test.buttonbutton.value = "button button";
136 });
137 });
138
139 });
140
141
142 it("responds when child elements are clicked on", function(){
143 expect(click(test.buttonnested, test.buttonnested.element.firstChild)).toHaveBeenCalled();
144 });
145
146 it("supports converters for label", function(){
147 expect(test.converterbutton.label).toBe("PASS");
148 expect(test.converterbutton.element.value).toBe("PASS");
149 });
150
151 // TODO should be transplanted to the press-composer-spec
152 // it("correctly releases the pointer", function() {
153 // var l = testPage.addListener(test.scroll_button);
154
155 // testpage.mouseEvent({target: test.scroll_button.element}, "mousedown");;
156 // expect(test.scroll_button.active).toBe(true);
157 // test.scroll_button.surrenderPointer(test.scroll_button._observedPointer, null);
158 // expect(test.scroll_button.active).toBe(false);
159 // testPage.mouseEvent({target: test.scroll_button.element}, "mouseup");;
160
161 // expect(l).not.toHaveBeenCalled();
162
163 // });
164
165 if (window.Touch) {
166
167 describe("when supporting touch events", function() {
168
169 it("should dispatch an action event when a touchend follows a touchstart on a button", function() {
170
171 });
172
173 });
174
175 } else {
176
177 describe("when supporting mouse events", function() {
178 it("dispatches an action event when a mouseup follows a mousedown", function() {
179 expect(click(test.inputbutton)).toHaveBeenCalled();
180 });
181
182 it("does not dispatch an action event when a mouseup occurs after not previously receiving a mousedown", function() {
183 // reset interaction
184 // test.inputbutton._endInteraction();
185 var l = testPage.addListener(test.inputbutton);
186 testPage.mouseEvent({target: test.inputbutton.element}, "mouseup");;
187 expect(l).not.toHaveBeenCalled();
188 });
189
190 it("does not dispatch an action event when a mouseup occurs away from the button after a mousedown on a button", function() {
191 var l = testPage.addListener(test.inputbutton);
192
193 testpage.mouseEvent({target: test.inputbutton.element}, "mousedown");;
194 // Mouse up somewhere else
195 testPage.mouseEvent({target: test.divbutton.element}, "mouseup");;
196
197 expect(l).not.toHaveBeenCalled();
198 });