sproutcore 1.10.1 → 1.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/CHANGELOG +13 -0
- data/VERSION.yml +1 -1
- data/lib/frameworks/sproutcore/CHANGELOG.md +69 -31
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +14 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/object.js +14 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +7 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +13 -9
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +57 -23
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/enabled_states_test.js +24 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +63 -13
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +7 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/system/many_array.js +28 -5
- data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +15 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +30 -3
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +23 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/many_attribute.js +135 -89
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/single_attribute.js +12 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +18 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/ui.js +58 -20
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/methods.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select/methods.js +15 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +10 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select.js +24 -23
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/popup_button.js +10 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/delegates/inline_text_field.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_mixin.js +33 -16
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +14 -6
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/control.js +23 -18
- data/lib/frameworks/sproutcore/frameworks/foundation/system/user_defaults.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/delegates/inline_text_field/inline_text_field.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/auto_mixin_tests.js +78 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/auto_resize_test.js +45 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/content_value_support/content.js +112 -58
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/image_queue.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/transition_test.js +141 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +27 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +631 -593
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/swap_fade_color_transition.js +5 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/swap_move_in_transition.js +5 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/swap_reveal_transition.js +68 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +128 -49
- data/lib/frameworks/sproutcore/frameworks/foundation/views/field.js +33 -8
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +209 -187
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +7 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +34 -4
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +0 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +68 -9
- data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +2 -1
- data/lib/sproutcore/rack/builder.rb +45 -25
- data/sproutcore.gemspec +1 -0
- metadata +17 -2
@@ -0,0 +1,78 @@
|
|
1
|
+
// ==========================================================================
|
2
|
+
// Project: Showcase
|
3
|
+
// Copyright: ©2013 7x7 Software, Inc.
|
4
|
+
// License: Licensed under MIT license
|
5
|
+
// ==========================================================================
|
6
|
+
/*globals module, test, ok, equals */
|
7
|
+
|
8
|
+
module("SC.AutoMixin");
|
9
|
+
|
10
|
+
test("Auto mixins should be applied to child views.", function () {
|
11
|
+
var A, B, a, d;
|
12
|
+
|
13
|
+
// Create a child view ahead of time. This will be unaffected by autoMixins.
|
14
|
+
d = SC.View.create({
|
15
|
+
foo: false
|
16
|
+
});
|
17
|
+
|
18
|
+
B = SC.View.extend({
|
19
|
+
baz: false
|
20
|
+
});
|
21
|
+
|
22
|
+
// Create a view class that uses SC.AutoMixin
|
23
|
+
A = SC.View.extend(SC.AutoMixin, {
|
24
|
+
autoMixins: [{ foo: true }, { bar: true }],
|
25
|
+
|
26
|
+
createChildViews: function () {
|
27
|
+
var childViews = this.get('childViews'),
|
28
|
+
len = childViews.length,
|
29
|
+
idx, key, view;
|
30
|
+
|
31
|
+
// swap the array
|
32
|
+
for (idx = 0; idx < len; ++idx) {
|
33
|
+
key = view = childViews[idx];
|
34
|
+
|
35
|
+
// is this is a key name, lookup view class
|
36
|
+
if (typeof key === SC.T_STRING) {
|
37
|
+
view = this[key];
|
38
|
+
} else {
|
39
|
+
key = null;
|
40
|
+
}
|
41
|
+
|
42
|
+
var uniqueHash = { idx: idx };
|
43
|
+
uniqueHash['prop_for_view_' + idx] = true;
|
44
|
+
view = this.createChildView(view, uniqueHash);
|
45
|
+
if (key) { this[key] = view; } // save on key name if passed
|
46
|
+
|
47
|
+
childViews[idx] = view;
|
48
|
+
}
|
49
|
+
|
50
|
+
return this;
|
51
|
+
},
|
52
|
+
|
53
|
+
childViews: ['b', 'c', d],
|
54
|
+
|
55
|
+
b: B.extend({
|
56
|
+
bar: false,
|
57
|
+
baz: true
|
58
|
+
}),
|
59
|
+
c: B
|
60
|
+
});
|
61
|
+
|
62
|
+
// Create an instance of the view class.
|
63
|
+
a = A.create();
|
64
|
+
ok(a.b.foo, "The first child view has the foo property.");
|
65
|
+
ok(a.b.bar, "The first child view has the bar property (overridden by mixin).");
|
66
|
+
ok(a.b.baz, "The first child view has the baz property (overridden by extend).");
|
67
|
+
equals(a.b.idx, 0, "The first child view has the idx property of");
|
68
|
+
ok(a.b.prop_for_view_0, "The first child view has the prop_for_view_0 property (set by the view).");
|
69
|
+
|
70
|
+
ok(a.c.foo, "The second child view has the foo property.");
|
71
|
+
ok(a.c.bar, "The second child view has the bar property.");
|
72
|
+
ok(!a.c.baz, "The second child view doesn't have the baz value from the previous child view.");
|
73
|
+
equals(a.c.idx, 1, "The second child view has the idx property of");
|
74
|
+
ok(SC.none(a.c.prop_for_view_0), "The second child view doesn't have the prop_for_view_0 property (set by the view on previous child view).");
|
75
|
+
ok(a.c.prop_for_view_1, "The second child view has the prop_for_view_1 property (set by the view).");
|
76
|
+
|
77
|
+
ok(!d.foo, "The pre-initialized child view is unaffected by autoMixins.");
|
78
|
+
});
|
@@ -14,7 +14,7 @@ module("SC.AutoResize", {
|
|
14
14
|
|
15
15
|
setup: function () {
|
16
16
|
view = SC.LabelView.create(SC.AutoResize, {
|
17
|
-
layout: { left: 0, height: 40},
|
17
|
+
layout: { left: 0, height: 40 },
|
18
18
|
value: "The bottom line, Williams said, is that the internet is “a giant machine designed to give people what they want.” It’s not a utopia. It’s not magical. It’s simply an engine of convenience. Those who can tune that engine well — who solve basic human problems with greater speed and simplicity than those who came before — will profit immensely. Those who lose sight of basic human needs — who want to give people the next great idea — will have problems. “We often think of the internet enables you to do new things,” Williams said. “But people just want to do the same things they’ve always done.”"
|
19
19
|
});
|
20
20
|
},
|
@@ -100,3 +100,47 @@ test("Resize with transition plugin - conflict", function () {
|
|
100
100
|
start();
|
101
101
|
}, 700);
|
102
102
|
});
|
103
|
+
|
104
|
+
|
105
|
+
test("Resize with child view layout", function () {
|
106
|
+
stop(700);
|
107
|
+
|
108
|
+
var pane, view2;
|
109
|
+
|
110
|
+
SC.run(function () {
|
111
|
+
pane = SC.Pane.create({
|
112
|
+
childViews: ['a', 'b'],
|
113
|
+
layout: { top: 200, left: 0, width: 200, height: 200 },
|
114
|
+
childViewLayout: SC.View.HORIZONTAL_STACK,
|
115
|
+
|
116
|
+
a: SC.View.extend({
|
117
|
+
layout: { width: 100 }
|
118
|
+
}),
|
119
|
+
|
120
|
+
b: SC.View.extend({
|
121
|
+
layout: { width: 50 }
|
122
|
+
})
|
123
|
+
});
|
124
|
+
|
125
|
+
pane.appendChild(view);
|
126
|
+
equals(view.get('layout').width, 10, 'width is');
|
127
|
+
equals(view.get('layout').left, 0, 'left is');
|
128
|
+
pane.append();
|
129
|
+
|
130
|
+
view2 = SC.View.create({
|
131
|
+
layout: { width: 100 }
|
132
|
+
});
|
133
|
+
pane.appendChild(view2);
|
134
|
+
});
|
135
|
+
|
136
|
+
setTimeout(function () {
|
137
|
+
ok(view.get('layout').width > 2000, 'width is > 2000');
|
138
|
+
equals(view.get('layout').left, 150, 'left is');
|
139
|
+
ok(view2.get('layout').left > 2000, 'left: %@ is > 2000'.fmt(view2.get('layout').left));
|
140
|
+
|
141
|
+
pane.destroy();
|
142
|
+
pane.remove();
|
143
|
+
|
144
|
+
start();
|
145
|
+
}, 500);
|
146
|
+
});
|
data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/content_value_support/content.js
CHANGED
@@ -4,117 +4,172 @@
|
|
4
4
|
// License: Licensed under MIT license (see license.js)
|
5
5
|
// ==========================================================================
|
6
6
|
|
7
|
-
/*global module test equals
|
7
|
+
/*global module, test, equals, ok */
|
8
8
|
|
9
9
|
// ..........................................................
|
10
10
|
// contentPropertyDidChange()
|
11
|
-
//
|
12
|
-
var view, content
|
11
|
+
//
|
12
|
+
var view, content;
|
13
13
|
module('SC.ContentValueSupport#contentPropertyDidChange', {
|
14
|
-
setup: function() {
|
14
|
+
setup: function () {
|
15
15
|
content = SC.Object.create();
|
16
16
|
view = SC.View.create(SC.ContentValueSupport);
|
17
17
|
},
|
18
|
-
|
19
|
-
teardown: function() {
|
18
|
+
|
19
|
+
teardown: function () {
|
20
20
|
content = null;
|
21
21
|
view.destroy();
|
22
22
|
}
|
23
23
|
});
|
24
24
|
|
25
|
-
test("invoked with key = * whenever content changes", function() {
|
26
|
-
view.contentPropertyDidChange = function(target, key) {
|
25
|
+
test("invoked with key = * whenever content changes", function () {
|
26
|
+
view.contentPropertyDidChange = function (target, key) {
|
27
27
|
ok(target === content, 'should pass content object as target target=%@'.fmt(target));
|
28
|
-
equals(key, '*', 'should pass * as key');
|
28
|
+
equals(key, '*', 'should pass * as key');
|
29
29
|
};
|
30
30
|
view.set('content', content);
|
31
31
|
});
|
32
32
|
|
33
|
-
test("should not be invoked when arbitrary keys are changed", function() {
|
33
|
+
test("should not be invoked when arbitrary keys are changed", function () {
|
34
34
|
var isTesting = NO, count = 0;
|
35
|
-
view.contentPropertyDidChange = function(target, key) {
|
36
|
-
if (!isTesting) return
|
35
|
+
view.contentPropertyDidChange = function (target, key) {
|
36
|
+
if (!isTesting) return; //wait until testing should begin...
|
37
37
|
count++;
|
38
38
|
};
|
39
39
|
|
40
40
|
view.set('content', content);
|
41
|
-
|
42
|
-
isTesting = YES
|
43
|
-
|
41
|
+
|
42
|
+
isTesting = YES;
|
43
|
+
|
44
44
|
content.set('foo', 'foo');
|
45
45
|
content.set('bar', 'bar');
|
46
46
|
|
47
47
|
equals(count, 0, "method was not invoked");
|
48
48
|
});
|
49
49
|
|
50
|
-
test("should no longer be invoked when a key is changed on a former content object", function() {
|
50
|
+
test("should no longer be invoked when a key is changed on a former content object", function () {
|
51
51
|
var isTesting = NO;
|
52
|
-
view.contentPropertyDidChange = function(target, key) {
|
53
|
-
if (!isTesting) return
|
52
|
+
view.contentPropertyDidChange = function (target, key) {
|
53
|
+
if (!isTesting) return; //wait until testing should begin...
|
54
54
|
ok(NO, 'should not invoke contentPropertyDidChange after content is removed');
|
55
55
|
};
|
56
|
-
|
56
|
+
|
57
57
|
view.set('content', content);
|
58
58
|
content.set('foo', 'foo');
|
59
59
|
view.set('content', null);
|
60
|
-
|
61
|
-
isTesting= YES
|
60
|
+
|
61
|
+
isTesting = YES;
|
62
62
|
content.set('bar', 'bar');
|
63
63
|
});
|
64
64
|
|
65
|
-
test("should fire even on a content object set when the object is created", function() {
|
65
|
+
test("should fire even on a content object set when the object is created", function () {
|
66
66
|
var callCount = 0;
|
67
67
|
var view = SC.View.create(SC.ContentValueSupport, {
|
68
|
-
contentPropertyDidChange: function() { callCount++; },
|
68
|
+
contentPropertyDidChange: function () { callCount++; },
|
69
69
|
content: content
|
70
70
|
});
|
71
|
-
|
71
|
+
|
72
72
|
equals(callCount, 1, 'should call contentPropertyDidChange on init to do initial setup');
|
73
|
-
|
73
|
+
|
74
74
|
content.set('foo', 'foo');
|
75
75
|
equals(callCount, 1, 'should not call contentPropertyDidChange when changing content.foo');
|
76
76
|
});
|
77
77
|
|
78
|
+
test("should call updatePropertyFromContent for all properties when content changes", function () {
|
79
|
+
var originalContent = SC.Object.create({
|
80
|
+
contentFoo: 'foo1',
|
81
|
+
contentBar: 'bar1'
|
82
|
+
});
|
83
|
+
|
84
|
+
var fooDidChangeCount = 0,
|
85
|
+
barDidChangeCount = 0;
|
86
|
+
|
87
|
+
var view = SC.View.create(SC.ContentValueSupport, {
|
88
|
+
contentKeys: {
|
89
|
+
'contentFooKey': 'foo',
|
90
|
+
'contentBarKey': 'bar'
|
91
|
+
},
|
92
|
+
contentFooKey: 'contentFoo',
|
93
|
+
contentBarKey: 'contentBar',
|
94
|
+
|
95
|
+
foo: null,
|
96
|
+
bar: null,
|
97
|
+
|
98
|
+
fooDidChange: function () {
|
99
|
+
fooDidChangeCount++;
|
100
|
+
}.observes('foo'),
|
101
|
+
|
102
|
+
barDidChange: function () {
|
103
|
+
barDidChangeCount++;
|
104
|
+
}.observes('bar'),
|
105
|
+
|
106
|
+
content: null
|
107
|
+
});
|
108
|
+
|
109
|
+
equals(fooDidChangeCount, 0, "foo indicated as changed this many times");
|
110
|
+
equals(barDidChangeCount, 0, "bar indicated as changed this many times");
|
111
|
+
|
112
|
+
view.set('content', originalContent);
|
113
|
+
|
114
|
+
equals(fooDidChangeCount, 1, "foo indicated as changed this many times");
|
115
|
+
equals(barDidChangeCount, 1, "bar indicated as changed this many times");
|
116
|
+
|
117
|
+
// set new content
|
118
|
+
var newContent = SC.Object.create({
|
119
|
+
contentFoo: 'foo2',
|
120
|
+
contentBar: 'bar2'
|
121
|
+
});
|
122
|
+
|
123
|
+
view.set('content', newContent);
|
124
|
+
|
125
|
+
equals(fooDidChangeCount, 2, "foo indicated as changed this many times");
|
126
|
+
equals(barDidChangeCount, 2, "bar indicated as changed this many times");
|
127
|
+
|
128
|
+
// Clean up.
|
129
|
+
originalContent.destroy();
|
130
|
+
newContent.destroy();
|
131
|
+
});
|
132
|
+
|
78
133
|
// ..........................................................
|
79
134
|
// updatePropertyFromContent()
|
80
|
-
//
|
135
|
+
//
|
81
136
|
module("SC.ContentValueSupport#updatePropertyFromContent()", {
|
82
|
-
setup: function() {
|
137
|
+
setup: function () {
|
83
138
|
content = SC.Object.create({ foo: "foo", bar: "bar" });
|
84
139
|
view = SC.View.create(SC.ContentValueSupport, { content: content });
|
85
140
|
},
|
86
|
-
teardown: function() {
|
87
|
-
content = null
|
141
|
+
teardown: function () {
|
142
|
+
content = null;
|
88
143
|
view.destroy();
|
89
144
|
}
|
90
|
-
})
|
145
|
+
});
|
91
146
|
|
92
|
-
test("copies value of content[key] to this[prop] if changed key. Gets key from contentKey property", function() {
|
147
|
+
test("copies value of content[key] to this[prop] if changed key. Gets key from contentKey property", function () {
|
93
148
|
view.contentValueKey = 'foo'; // set key mapping.
|
94
149
|
view.updatePropertyFromContent('value', 'foo', 'contentValueKey');
|
95
150
|
equals(view.get('value'), 'foo', 'should copy foo from content.foo to value');
|
96
151
|
});
|
97
152
|
|
98
|
-
test("does nothing of changed key does not match contentKey value"
|
153
|
+
test("does nothing of changed key does not match contentKey value", function () {
|
99
154
|
view.value = "foo";
|
100
|
-
view.contentValueKey = "foo"
|
155
|
+
view.contentValueKey = "foo";
|
101
156
|
view.updatePropertyFromContent('value', 'bar', 'contentValueKey');
|
102
157
|
equals(view.get('value'), 'foo', 'should not have changed "value"');
|
103
158
|
});
|
104
159
|
|
105
|
-
test("if contentKey is not passed, assume contentPROPKey", function() {
|
160
|
+
test("if contentKey is not passed, assume contentPROPKey", function () {
|
106
161
|
view.contentValueKey = "foo";
|
107
162
|
view.updatePropertyFromContent("value", "foo");
|
108
163
|
equals(view.get('value'), 'foo', 'should have looked at foo since contentValueKey is set to foo');
|
109
164
|
});
|
110
165
|
|
111
|
-
test("if contentFooKey is not set on receiver, ask displayDelegate", function() {
|
166
|
+
test("if contentFooKey is not set on receiver, ask displayDelegate", function () {
|
112
167
|
view.displayDelegate = SC.Object.create({ contentValueKey: "foo" });
|
113
168
|
view.updatePropertyFromContent("value", "foo", "contentValueKey");
|
114
169
|
equals(view.get('value'), 'foo', 'should have looked at foo since contentValueKey is set to foo');
|
115
170
|
});
|
116
171
|
|
117
|
-
test("should be able to get value from a content object that is not SC.Object", function() {
|
172
|
+
test("should be able to get value from a content object that is not SC.Object", function () {
|
118
173
|
view.content = { foo: "foo" };
|
119
174
|
view.contentValueKey = "foo";
|
120
175
|
view.updatePropertyFromContent("value", "foo", "contentValueKey");
|
@@ -123,42 +178,42 @@ test("should be able to get value from a content object that is not SC.Object",
|
|
123
178
|
|
124
179
|
// ..........................................................
|
125
180
|
// updateContentWithValueObserver()
|
126
|
-
//
|
181
|
+
//
|
127
182
|
module("SC.ContentValueSupport#updatePropertyFromContent()", {
|
128
|
-
setup: function() {
|
183
|
+
setup: function () {
|
129
184
|
content = SC.Object.create({ foo: "foo", bar: "bar" });
|
130
|
-
view = SC.View.create(SC.ContentValueSupport, {
|
185
|
+
view = SC.View.create(SC.ContentValueSupport, {
|
131
186
|
value: "bar",
|
132
187
|
content: content,
|
133
188
|
contentValueKey: "bar",
|
134
|
-
displayDelegate: SC.Object.create({ contentValueKey: "foo" })
|
189
|
+
displayDelegate: SC.Object.create({ contentValueKey: "foo" })
|
135
190
|
});
|
136
191
|
},
|
137
|
-
teardown: function() {
|
138
|
-
content = null
|
192
|
+
teardown: function () {
|
193
|
+
content = null;
|
139
194
|
view.destroy();
|
140
195
|
}
|
141
|
-
})
|
196
|
+
});
|
142
197
|
|
143
|
-
test("if contentValueKey is set, changing value will be pushed to content", function() {
|
198
|
+
test("if contentValueKey is set, changing value will be pushed to content", function () {
|
144
199
|
view.set('value', 'baz');
|
145
200
|
equals(content.get('bar'), 'baz', 'should copy from view.value to content');
|
146
201
|
});
|
147
202
|
|
148
|
-
test("does nothing if content is null", function() {
|
203
|
+
test("does nothing if content is null", function () {
|
149
204
|
view.set('content', null);
|
150
205
|
view.set('value', 'baz'); // should be no errors here...
|
151
206
|
equals(content.get('bar'), 'bar', 'should not change');
|
152
207
|
equals(content.get('foo'), 'foo', 'should not change');
|
153
208
|
});
|
154
209
|
|
155
|
-
test("if contentValueKey is undefined, asks display delegate instead", function() {
|
156
|
-
delete view.contentValueKey
|
210
|
+
test("if contentValueKey is undefined, asks display delegate instead", function () {
|
211
|
+
delete view.contentValueKey;
|
157
212
|
view.set('value', 'baz');
|
158
213
|
equals(content.get('foo'), 'baz', 'should copy from view.value to content');
|
159
214
|
});
|
160
215
|
|
161
|
-
test("if contentValueKey is not set & displayDelegate not set, does nothing", function() {
|
216
|
+
test("if contentValueKey is not set & displayDelegate not set, does nothing", function () {
|
162
217
|
delete view.contentValueKey;
|
163
218
|
delete view.displayDelegate;
|
164
219
|
view.set('value', 'baz');
|
@@ -168,9 +223,9 @@ test("if contentValueKey is not set & displayDelegate not set, does nothing", fu
|
|
168
223
|
|
169
224
|
// ..........................................................
|
170
225
|
// updateContentWithValueObserver()
|
171
|
-
//
|
226
|
+
//
|
172
227
|
module("SC.ContentValueSupport#contentKeys", {
|
173
|
-
setup: function() {
|
228
|
+
setup: function () {
|
174
229
|
this.count = 0;
|
175
230
|
var self = this;
|
176
231
|
|
@@ -178,7 +233,7 @@ module("SC.ContentValueSupport#contentKeys", {
|
|
178
233
|
contentKeys: {'contentFooKey': 'foo'},
|
179
234
|
contentFooKey: 'foo',
|
180
235
|
content: SC.Object.create({foo: 'BAR'}),
|
181
|
-
contentPropertyDidChange: function(orig, target, key) {
|
236
|
+
contentPropertyDidChange: function (orig, target, key) {
|
182
237
|
equals(target, this.content, "content is target");
|
183
238
|
self.count++;
|
184
239
|
|
@@ -187,15 +242,15 @@ module("SC.ContentValueSupport#contentKeys", {
|
|
187
242
|
});
|
188
243
|
},
|
189
244
|
|
190
|
-
teardown: function() {
|
245
|
+
teardown: function () {
|
191
246
|
this.obj.destroy();
|
192
247
|
|
193
248
|
this.obj = null;
|
194
249
|
}
|
195
250
|
});
|
196
251
|
|
197
|
-
test("different contentKeys on creation are observed correctly", function() {
|
198
|
-
equals(this.count, 1, "
|
252
|
+
test("different contentKeys on creation are observed correctly", function () {
|
253
|
+
equals(this.count, 1, "Content property setup was called on init");
|
199
254
|
|
200
255
|
this.obj.content.set('foo', 'BAR2');
|
201
256
|
|
@@ -208,8 +263,8 @@ test("different contentKeys on creation are observed correctly", function() {
|
|
208
263
|
equals(this.count, 2, "observer was not called again on setting other keys");
|
209
264
|
});
|
210
265
|
|
211
|
-
test("different contentKeys after creation are observed correctly", function() {
|
212
|
-
equals(this.count, 1,
|
266
|
+
test("different contentKeys after creation are observed correctly", function () {
|
267
|
+
equals(this.count, 1, "Content property setup was called on init");
|
213
268
|
|
214
269
|
this.obj.beginPropertyChanges();
|
215
270
|
this.obj.set({
|
@@ -218,7 +273,7 @@ test("different contentKeys after creation are observed correctly", function() {
|
|
218
273
|
});
|
219
274
|
this.obj.endPropertyChanges();
|
220
275
|
|
221
|
-
equals(this.count, 2, "observer was called when changing contentKeys");
|
276
|
+
equals(this.count, 2, "observer was called again when changing contentKeys");
|
222
277
|
|
223
278
|
this.obj.content.set('bar', 'BAR2');
|
224
279
|
|
@@ -234,4 +289,3 @@ test("different contentKeys after creation are observed correctly", function() {
|
|
234
289
|
|
235
290
|
equals(this.count, 3, "observer was not called again on setting old observed keys");
|
236
291
|
});
|
237
|
-
|
@@ -13,8 +13,8 @@ var guardTimeout, firstGoodImageURL, secondGoodImageURL, badImageURL;
|
|
13
13
|
module("Image Queue", {
|
14
14
|
setup: function() {
|
15
15
|
guardTimeout = 30000;
|
16
|
-
firstGoodImageURL = sc_static('images/sproutcore-
|
17
|
-
secondGoodImageURL = sc_static('images/sproutcore-
|
16
|
+
firstGoodImageURL = sc_static('images/sproutcore-32.png');
|
17
|
+
secondGoodImageURL = sc_static('images/sproutcore-48.png');
|
18
18
|
badImageURL = "http://www.sproutcore.com/images/foobar.png";
|
19
19
|
}
|
20
20
|
});
|
data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/transition_test.js
CHANGED
@@ -75,6 +75,147 @@ test("Test that the isTransitioning property of container view updates according
|
|
75
75
|
}, 1000);
|
76
76
|
});
|
77
77
|
|
78
|
+
test("Test changing nowShowing while the container is already transitioning with pre-initialized views: DISSOLVE.", function () {
|
79
|
+
// Pause the test execution.
|
80
|
+
window.stop(2000);
|
81
|
+
|
82
|
+
SC.run(function () {
|
83
|
+
containerView.set('transitionSwap', SC.ContainerView.DISSOLVE);
|
84
|
+
containerView.set('nowShowing', view2);
|
85
|
+
});
|
86
|
+
|
87
|
+
setTimeout(function () {
|
88
|
+
SC.run(function () {
|
89
|
+
containerView.set('nowShowing', view1);
|
90
|
+
});
|
91
|
+
}, 100);
|
92
|
+
|
93
|
+
setTimeout(function () {
|
94
|
+
SC.run(function () {
|
95
|
+
containerView.set('nowShowing', view2);
|
96
|
+
});
|
97
|
+
}, 150);
|
98
|
+
|
99
|
+
setTimeout(function () {
|
100
|
+
ok(!containerView.get('isTransitioning'), "Container view should not indicate that it is transitioning.");
|
101
|
+
|
102
|
+
window.start();
|
103
|
+
}, 1500);
|
104
|
+
});
|
105
|
+
|
106
|
+
test("Test changing nowShowing while the container is already transitioning with pre-initialized views: MOVE_IN.", function () {
|
107
|
+
// Pause the test execution.
|
108
|
+
window.stop(2000);
|
109
|
+
|
110
|
+
SC.run(function () {
|
111
|
+
containerView.set('transitionSwap', SC.ContainerView.MOVE_IN);
|
112
|
+
containerView.set('nowShowing', view2);
|
113
|
+
});
|
114
|
+
|
115
|
+
setTimeout(function () {
|
116
|
+
SC.run(function () {
|
117
|
+
containerView.set('nowShowing', view1);
|
118
|
+
});
|
119
|
+
}, 100);
|
120
|
+
|
121
|
+
setTimeout(function () {
|
122
|
+
SC.run(function () {
|
123
|
+
containerView.set('nowShowing', view2);
|
124
|
+
});
|
125
|
+
}, 150);
|
126
|
+
|
127
|
+
setTimeout(function () {
|
128
|
+
ok(!containerView.get('isTransitioning'), "Container view should not indicate that it is transitioning.");
|
129
|
+
|
130
|
+
window.start();
|
131
|
+
}, 1500);
|
132
|
+
});
|
133
|
+
|
134
|
+
|
135
|
+
test("Test changing nowShowing while the container is already transitioning with pre-initialized views: REVEAL.", function () {
|
136
|
+
// Pause the test execution.
|
137
|
+
window.stop(2000);
|
138
|
+
|
139
|
+
SC.run(function () {
|
140
|
+
containerView.set('transitionSwap', SC.ContainerView.REVEAL);
|
141
|
+
containerView.set('nowShowing', view2);
|
142
|
+
});
|
143
|
+
|
144
|
+
setTimeout(function () {
|
145
|
+
SC.run(function () {
|
146
|
+
containerView.set('nowShowing', view1);
|
147
|
+
});
|
148
|
+
}, 100);
|
149
|
+
|
150
|
+
setTimeout(function () {
|
151
|
+
SC.run(function () {
|
152
|
+
containerView.set('nowShowing', view2);
|
153
|
+
});
|
154
|
+
}, 150);
|
155
|
+
|
156
|
+
setTimeout(function () {
|
157
|
+
ok(!containerView.get('isTransitioning'), "Container view should not indicate that it is transitioning.");
|
158
|
+
|
159
|
+
window.start();
|
160
|
+
}, 1500);
|
161
|
+
});
|
162
|
+
|
163
|
+
test("Test changing nowShowing while the container is already transitioning with pre-initialized views: PUSH.", function () {
|
164
|
+
// Pause the test execution.
|
165
|
+
window.stop(2000);
|
166
|
+
|
167
|
+
SC.run(function () {
|
168
|
+
containerView.set('transitionSwap', SC.ContainerView.PUSH);
|
169
|
+
containerView.set('nowShowing', view2);
|
170
|
+
});
|
171
|
+
|
172
|
+
setTimeout(function () {
|
173
|
+
SC.run(function () {
|
174
|
+
containerView.set('nowShowing', view1);
|
175
|
+
});
|
176
|
+
}, 100);
|
177
|
+
|
178
|
+
setTimeout(function () {
|
179
|
+
SC.run(function () {
|
180
|
+
containerView.set('nowShowing', view2);
|
181
|
+
});
|
182
|
+
}, 150);
|
183
|
+
|
184
|
+
setTimeout(function () {
|
185
|
+
ok(!containerView.get('isTransitioning'), "Container view should not indicate that it is transitioning.");
|
186
|
+
|
187
|
+
window.start();
|
188
|
+
}, 1500);
|
189
|
+
});
|
190
|
+
|
191
|
+
test("Test changing nowShowing while the container is already transitioning with pre-initialized views: FADE_COLOR.", function () {
|
192
|
+
// Pause the test execution.
|
193
|
+
window.stop(2000);
|
194
|
+
|
195
|
+
SC.run(function () {
|
196
|
+
containerView.set('transitionSwap', SC.ContainerView.FADE_COLOR);
|
197
|
+
containerView.set('nowShowing', view2);
|
198
|
+
});
|
199
|
+
|
200
|
+
setTimeout(function () {
|
201
|
+
SC.run(function () {
|
202
|
+
containerView.set('nowShowing', view1);
|
203
|
+
});
|
204
|
+
}, 100);
|
205
|
+
|
206
|
+
setTimeout(function () {
|
207
|
+
SC.run(function () {
|
208
|
+
containerView.set('nowShowing', view2);
|
209
|
+
});
|
210
|
+
}, 150);
|
211
|
+
|
212
|
+
setTimeout(function () {
|
213
|
+
ok(!containerView.get('isTransitioning'), "Container view should not indicate that it is transitioning.");
|
214
|
+
|
215
|
+
window.start();
|
216
|
+
}, 1500);
|
217
|
+
});
|
218
|
+
|
78
219
|
test("Test that the container view calls the proper transition plugin methods.", function () {
|
79
220
|
var willBuildInToViewCalled = 0,
|
80
221
|
buildInToViewCalled = 0,
|