ember-source 1.9.0.beta.1.1 → 1.9.0.beta.3
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.
Potentially problematic release.
This version of ember-source might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/dist/ember-runtime.js +219 -116
- data/dist/ember-testing.js +1 -1
- data/dist/ember-tests.js +1380 -612
- data/dist/ember-tests.prod.js +1380 -612
- data/dist/ember.js +325 -227
- data/dist/ember.min.js +12 -12
- data/dist/ember.prod.js +321 -228
- metadata +2 -2
data/dist/ember-tests.prod.js
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
|
6
6
|
* @license Licensed under MIT license
|
7
7
|
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
|
8
|
-
* @version 1.9.0-beta.
|
8
|
+
* @version 1.9.0-beta.3
|
9
9
|
*/
|
10
10
|
|
11
11
|
(function() {
|
@@ -648,6 +648,28 @@ enifed("container/tests/container_test",
|
|
648
648
|
deepEqual(container.lookup('controller:post'), user, "Normalizes the name when injecting");
|
649
649
|
});
|
650
650
|
|
651
|
+
test("The container can get options that should be applied to a given factory", function(){
|
652
|
+
var container = new Container();
|
653
|
+
|
654
|
+
var PostView = factory();
|
655
|
+
|
656
|
+
container.resolver = function(fullName) {
|
657
|
+
if (fullName === 'view:post') {
|
658
|
+
return PostView;
|
659
|
+
}
|
660
|
+
};
|
661
|
+
|
662
|
+
container.options('view:post', {instantiate: true, singleton: false});
|
663
|
+
|
664
|
+
var postView1 = container.lookup('view:post');
|
665
|
+
var postView2 = container.lookup('view:post');
|
666
|
+
|
667
|
+
ok(postView1 instanceof PostView, "The correct factory was provided");
|
668
|
+
ok(postView2 instanceof PostView, "The correct factory was provided");
|
669
|
+
|
670
|
+
ok(postView1 !== postView2, "The two lookups are different");
|
671
|
+
});
|
672
|
+
|
651
673
|
test("The container can get options that should be applied to all factories for a given type", function() {
|
652
674
|
var container = new Container();
|
653
675
|
var PostView = factory();
|
@@ -1915,6 +1937,23 @@ enifed("ember-application/tests/system/initializers_test",
|
|
1915
1937
|
}
|
1916
1938
|
});
|
1917
1939
|
|
1940
|
+
test("initializers require proper 'name' and 'initialize' properties", function() {
|
1941
|
+
var MyApplication = Application.extend();
|
1942
|
+
|
1943
|
+
expectAssertion(function() {
|
1944
|
+
run(function() {
|
1945
|
+
MyApplication.initializer({name:'initializer'});
|
1946
|
+
});
|
1947
|
+
});
|
1948
|
+
|
1949
|
+
expectAssertion(function() {
|
1950
|
+
run(function() {
|
1951
|
+
MyApplication.initializer({initialize:Ember.K});
|
1952
|
+
});
|
1953
|
+
});
|
1954
|
+
|
1955
|
+
});
|
1956
|
+
|
1918
1957
|
test("initializers can be registered in a specified order", function() {
|
1919
1958
|
var order = [];
|
1920
1959
|
var MyApplication = Application.extend();
|
@@ -2923,6 +2962,542 @@ enifed("ember-debug/tests/warn_if_using_stripped_feature_flags_test.jshint",
|
|
2923
2962
|
ok(true, 'ember-debug/tests/warn_if_using_stripped_feature_flags_test.js should pass jshint.');
|
2924
2963
|
});
|
2925
2964
|
});
|
2965
|
+
enifed("ember-dev/test-helper/assertion",
|
2966
|
+
["./method-call-expectation","./utils","exports"],
|
2967
|
+
function(__dependency1__, __dependency2__, __exports__) {
|
2968
|
+
"use strict";
|
2969
|
+
/* globals QUnit */
|
2970
|
+
|
2971
|
+
var MethodCallExpectation = __dependency1__["default"];
|
2972
|
+
var o_create = __dependency2__.o_create;
|
2973
|
+
|
2974
|
+
function AssertExpectation(Ember, message){
|
2975
|
+
MethodCallExpectation.call(this, Ember, 'assert');
|
2976
|
+
this.expectedMessage = message;
|
2977
|
+
}
|
2978
|
+
AssertExpectation.Error = function(){};
|
2979
|
+
AssertExpectation.prototype = o_create(MethodCallExpectation.prototype);
|
2980
|
+
AssertExpectation.prototype.handleCall = function(message, test){
|
2981
|
+
this.sawCall = true;
|
2982
|
+
if (test) {
|
2983
|
+
return; // Only get message for failures
|
2984
|
+
}
|
2985
|
+
this.actualMessage = message;
|
2986
|
+
// Halt execution
|
2987
|
+
throw new AssertExpectation.Error();
|
2988
|
+
};
|
2989
|
+
AssertExpectation.prototype.assert = function(fn){
|
2990
|
+
try {
|
2991
|
+
this.runWithStub(fn);
|
2992
|
+
} catch (e) {
|
2993
|
+
if (!(e instanceof AssertExpectation.Error)) {
|
2994
|
+
throw e;
|
2995
|
+
}
|
2996
|
+
}
|
2997
|
+
|
2998
|
+
// Run assertions in an order that is useful when debugging a test failure.
|
2999
|
+
//
|
3000
|
+
if (!this.sawCall) {
|
3001
|
+
QUnit.ok(false, "Expected Ember.assert to be called (Not called with any value).");
|
3002
|
+
} else if (!this.actualMessage) {
|
3003
|
+
QUnit.ok(false, 'Expected a failing Ember.assert (Ember.assert called, but without a failing test).');
|
3004
|
+
} else {
|
3005
|
+
if (this.expectedMessage) {
|
3006
|
+
if (this.expectedMessage instanceof RegExp) {
|
3007
|
+
QUnit.ok(this.expectedMessage.test(this.actualMessage), "Expected failing Ember.assert: '" + this.expectedMessage + "', but got '" + this.actualMessage + "'.");
|
3008
|
+
} else {
|
3009
|
+
QUnit.equal(this.actualMessage, this.expectedMessage, "Expected failing Ember.assert: '" + this.expectedMessage + "', but got '" + this.actualMessage + "'.");
|
3010
|
+
}
|
3011
|
+
} else {
|
3012
|
+
// Positive assertion that assert was called
|
3013
|
+
QUnit.ok(true, 'Expected a failing Ember.assert.');
|
3014
|
+
}
|
3015
|
+
}
|
3016
|
+
};
|
3017
|
+
|
3018
|
+
var AssertionAssert = function(env){
|
3019
|
+
this.env = env;
|
3020
|
+
};
|
3021
|
+
|
3022
|
+
AssertionAssert.prototype = {
|
3023
|
+
|
3024
|
+
reset: function(){
|
3025
|
+
},
|
3026
|
+
|
3027
|
+
inject: function(){
|
3028
|
+
|
3029
|
+
var assertion = this;
|
3030
|
+
|
3031
|
+
// Looks for an exception raised within the fn.
|
3032
|
+
//
|
3033
|
+
// expectAssertion(function(){
|
3034
|
+
// Ember.assert("Homie don't roll like that");
|
3035
|
+
// } /* , optionalMessageStringOrRegex */);
|
3036
|
+
//
|
3037
|
+
window.expectAssertion = function expectAssertion(fn, message){
|
3038
|
+
if (assertion.env.runningProdBuild){
|
3039
|
+
QUnit.ok(true, 'Assertions disabled in production builds.');
|
3040
|
+
return;
|
3041
|
+
}
|
3042
|
+
|
3043
|
+
// do not assert as the production builds do not contain Ember.assert
|
3044
|
+
(new AssertExpectation(assertion.env.Ember, message)).assert(fn);
|
3045
|
+
};
|
3046
|
+
|
3047
|
+
window.ignoreAssertion = function ignoreAssertion(fn){
|
3048
|
+
var stubber = new MethodCallExpectation(assertion.env.Ember, 'assert'),
|
3049
|
+
noop = function(){};
|
3050
|
+
|
3051
|
+
stubber.runWithStub(fn, noop);
|
3052
|
+
};
|
3053
|
+
|
3054
|
+
},
|
3055
|
+
|
3056
|
+
assert: function(){
|
3057
|
+
},
|
3058
|
+
|
3059
|
+
restore: function(){
|
3060
|
+
window.expectAssertion = null;
|
3061
|
+
window.ignoreAssertion = null;
|
3062
|
+
}
|
3063
|
+
|
3064
|
+
};
|
3065
|
+
|
3066
|
+
__exports__["default"] = AssertionAssert;
|
3067
|
+
});
|
3068
|
+
enifed("ember-dev/test-helper/deprecation",
|
3069
|
+
["./method-call-expectation","exports"],
|
3070
|
+
function(__dependency1__, __exports__) {
|
3071
|
+
"use strict";
|
3072
|
+
/* globals QUnit */
|
3073
|
+
|
3074
|
+
var MethodCallExpectation = __dependency1__["default"];
|
3075
|
+
|
3076
|
+
var NONE = function(){};
|
3077
|
+
|
3078
|
+
var DeprecationAssert = function(env){
|
3079
|
+
this.env = env;
|
3080
|
+
|
3081
|
+
this.reset();
|
3082
|
+
};
|
3083
|
+
|
3084
|
+
DeprecationAssert.prototype = {
|
3085
|
+
|
3086
|
+
reset: function(){
|
3087
|
+
this.expecteds = null;
|
3088
|
+
this.actuals = null;
|
3089
|
+
},
|
3090
|
+
|
3091
|
+
stubEmber: function(){
|
3092
|
+
if (!this._previousEmberDeprecate && this._previousEmberDeprecate !== this.env.Ember.deprecate) {
|
3093
|
+
this._previousEmberDeprecate = this.env.Ember.deprecate;
|
3094
|
+
}
|
3095
|
+
var assertion = this;
|
3096
|
+
this.env.Ember.deprecate = function(msg, test) {
|
3097
|
+
assertion.actuals = assertion.actuals || [];
|
3098
|
+
if (!test) {
|
3099
|
+
assertion.actuals.push([msg, test]);
|
3100
|
+
}
|
3101
|
+
};
|
3102
|
+
},
|
3103
|
+
|
3104
|
+
inject: function(){
|
3105
|
+
var assertion = this;
|
3106
|
+
|
3107
|
+
// Expects no deprecation to happen from the time of calling until
|
3108
|
+
// the end of the test.
|
3109
|
+
//
|
3110
|
+
// expectNoDeprecation(/* optionalStringOrRegex */);
|
3111
|
+
// Ember.deprecate("Old And Busted");
|
3112
|
+
//
|
3113
|
+
window.expectNoDeprecation = function() {
|
3114
|
+
if (assertion.expecteds != null && typeof assertion.expecteds === 'object') {
|
3115
|
+
throw new Error("expectNoDeprecation was called after expectDeprecation was called!");
|
3116
|
+
}
|
3117
|
+
assertion.stubEmber();
|
3118
|
+
assertion.expecteds = NONE;
|
3119
|
+
};
|
3120
|
+
|
3121
|
+
// Expect a deprecation to happen within a function, or if no function
|
3122
|
+
// is pass, from the time of calling until the end of the test. Can be called
|
3123
|
+
// multiple times to assert deprecations with different specific messages
|
3124
|
+
// were fired.
|
3125
|
+
//
|
3126
|
+
// expectDeprecation(function(){
|
3127
|
+
// Ember.deprecate("Old And Busted");
|
3128
|
+
// }, /* optionalStringOrRegex */);
|
3129
|
+
//
|
3130
|
+
// expectDeprecation(/* optionalStringOrRegex */);
|
3131
|
+
// Ember.deprecate("Old And Busted");
|
3132
|
+
//
|
3133
|
+
window.expectDeprecation = function(fn, message) {
|
3134
|
+
if (assertion.expecteds === NONE) {
|
3135
|
+
throw new Error("expectDeprecation was called after expectNoDeprecation was called!");
|
3136
|
+
}
|
3137
|
+
assertion.stubEmber();
|
3138
|
+
assertion.expecteds = assertion.expecteds || [];
|
3139
|
+
if (fn && typeof fn !== 'function') {
|
3140
|
+
// fn is a message
|
3141
|
+
assertion.expecteds.push(fn);
|
3142
|
+
} else {
|
3143
|
+
assertion.expecteds.push(message || /.*/);
|
3144
|
+
if (fn) {
|
3145
|
+
fn();
|
3146
|
+
assertion.assert();
|
3147
|
+
assertion.expecteds.pop();
|
3148
|
+
}
|
3149
|
+
}
|
3150
|
+
};
|
3151
|
+
|
3152
|
+
window.ignoreDeprecation = function ignoreDeprecation(fn){
|
3153
|
+
var stubber = new MethodCallExpectation(assertion.env.Ember, 'deprecate'),
|
3154
|
+
noop = function(){};
|
3155
|
+
|
3156
|
+
stubber.runWithStub(fn, noop);
|
3157
|
+
};
|
3158
|
+
|
3159
|
+
},
|
3160
|
+
|
3161
|
+
// Forces an assert the deprecations occurred, and resets the globals
|
3162
|
+
// storing asserts for the next run.
|
3163
|
+
//
|
3164
|
+
// expectNoDeprecation(/Old/);
|
3165
|
+
// setTimeout(function(){
|
3166
|
+
// Ember.deprecate("Old And Busted");
|
3167
|
+
// assertDeprecation();
|
3168
|
+
// });
|
3169
|
+
//
|
3170
|
+
// assertDeprecation is called after each test run to catch any expectations
|
3171
|
+
// without explicit asserts.
|
3172
|
+
//
|
3173
|
+
assert: function(){
|
3174
|
+
var expecteds = this.expecteds || [],
|
3175
|
+
actuals = this.actuals || [];
|
3176
|
+
var o, i;
|
3177
|
+
|
3178
|
+
if (expecteds !== NONE && expecteds.length === 0 && actuals.length === 0) {
|
3179
|
+
return;
|
3180
|
+
}
|
3181
|
+
|
3182
|
+
if (this.env.runningProdBuild){
|
3183
|
+
QUnit.ok(true, 'deprecations disabled in production builds.');
|
3184
|
+
return;
|
3185
|
+
}
|
3186
|
+
|
3187
|
+
if (expecteds === NONE) {
|
3188
|
+
var actualMessages = [];
|
3189
|
+
for (i=0;i<actuals.length;i++) {
|
3190
|
+
actualMessages.push(actuals[i][0]);
|
3191
|
+
}
|
3192
|
+
QUnit.ok(actuals.length === 0, "Expected no deprecation calls, got "+actuals.length+": "+actualMessages.join(', '));
|
3193
|
+
return;
|
3194
|
+
}
|
3195
|
+
|
3196
|
+
var expected, actual, match;
|
3197
|
+
|
3198
|
+
for (o=0;o < expecteds.length; o++) {
|
3199
|
+
expected = expecteds[o];
|
3200
|
+
for (i=0;i < actuals.length; i++) {
|
3201
|
+
actual = actuals[i];
|
3202
|
+
if (!actual[1]) {
|
3203
|
+
if (expected instanceof RegExp) {
|
3204
|
+
if (expected.test(actual[0])) {
|
3205
|
+
match = actual;
|
3206
|
+
break;
|
3207
|
+
}
|
3208
|
+
} else {
|
3209
|
+
if (expected === actual[0]) {
|
3210
|
+
match = actual;
|
3211
|
+
break;
|
3212
|
+
}
|
3213
|
+
}
|
3214
|
+
}
|
3215
|
+
}
|
3216
|
+
|
3217
|
+
if (!actual) {
|
3218
|
+
QUnit.ok(false, "Recieved no deprecate calls at all, expecting: "+expected);
|
3219
|
+
} else if (match && !match[1]) {
|
3220
|
+
QUnit.ok(true, "Recieved failing deprecation with message: "+match[0]);
|
3221
|
+
} else if (match && match[1]) {
|
3222
|
+
QUnit.ok(false, "Expected failing deprecation, got succeeding with message: "+match[0]);
|
3223
|
+
} else if (actual[1]) {
|
3224
|
+
QUnit.ok(false, "Did not receive failing deprecation matching '"+expected+"', last was success with '"+actual[0]+"'");
|
3225
|
+
} else if (!actual[1]) {
|
3226
|
+
QUnit.ok(false, "Did not receive failing deprecation matching '"+expected+"', last was failure with '"+actual[0]+"'");
|
3227
|
+
}
|
3228
|
+
}
|
3229
|
+
},
|
3230
|
+
|
3231
|
+
restore: function(){
|
3232
|
+
if (this._previousEmberDeprecate) {
|
3233
|
+
this.env.Ember.deprecate = this._previousEmberDeprecate;
|
3234
|
+
this._previousEmberDeprecate = null;
|
3235
|
+
}
|
3236
|
+
window.expectNoDeprecation = null;
|
3237
|
+
}
|
3238
|
+
|
3239
|
+
};
|
3240
|
+
|
3241
|
+
__exports__["default"] = DeprecationAssert;
|
3242
|
+
});
|
3243
|
+
enifed("ember-dev/test-helper/index",
|
3244
|
+
["./deprecation","./remaining-view","./remaining-template","./assertion","./run-loop","./utils","exports"],
|
3245
|
+
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __exports__) {
|
3246
|
+
"use strict";
|
3247
|
+
var DeprecationAssert = __dependency1__["default"];
|
3248
|
+
var RemainingViewAssert = __dependency2__["default"];
|
3249
|
+
var RemainingTemplateAssert = __dependency3__["default"];
|
3250
|
+
var AssertionAssert = __dependency4__["default"];
|
3251
|
+
var RunLoopAssert = __dependency5__["default"];
|
3252
|
+
|
3253
|
+
var buildCompositeAssert = __dependency6__.buildCompositeAssert;
|
3254
|
+
|
3255
|
+
var EmberDevTestHelperAssert = buildCompositeAssert([
|
3256
|
+
DeprecationAssert,
|
3257
|
+
RemainingViewAssert,
|
3258
|
+
RemainingTemplateAssert,
|
3259
|
+
AssertionAssert,
|
3260
|
+
RunLoopAssert
|
3261
|
+
]);
|
3262
|
+
|
3263
|
+
__exports__["default"] = EmberDevTestHelperAssert;
|
3264
|
+
});
|
3265
|
+
enifed("ember-dev/test-helper/method-call-expectation",
|
3266
|
+
["exports"],
|
3267
|
+
function(__exports__) {
|
3268
|
+
"use strict";
|
3269
|
+
/* globals QUnit */
|
3270
|
+
|
3271
|
+
// A light class for stubbing
|
3272
|
+
//
|
3273
|
+
function MethodCallExpectation(target, property){
|
3274
|
+
this.target = target;
|
3275
|
+
this.property = property;
|
3276
|
+
}
|
3277
|
+
|
3278
|
+
MethodCallExpectation.prototype = {
|
3279
|
+
handleCall: function(){
|
3280
|
+
this.sawCall = true;
|
3281
|
+
return this.originalMethod.apply(this.target, arguments);
|
3282
|
+
},
|
3283
|
+
stubMethod: function(replacementFunc){
|
3284
|
+
var context = this,
|
3285
|
+
property = this.property;
|
3286
|
+
|
3287
|
+
this.originalMethod = this.target[property];
|
3288
|
+
|
3289
|
+
if (typeof replacementFunc === 'function') {
|
3290
|
+
this.target[property] = replacementFunc;
|
3291
|
+
} else {
|
3292
|
+
this.target[property] = function(){
|
3293
|
+
return context.handleCall.apply(context, arguments);
|
3294
|
+
};
|
3295
|
+
}
|
3296
|
+
},
|
3297
|
+
restoreMethod: function(){
|
3298
|
+
this.target[this.property] = this.originalMethod;
|
3299
|
+
},
|
3300
|
+
runWithStub: function(fn, replacementFunc){
|
3301
|
+
try {
|
3302
|
+
this.stubMethod(replacementFunc);
|
3303
|
+
fn();
|
3304
|
+
} finally {
|
3305
|
+
this.restoreMethod();
|
3306
|
+
}
|
3307
|
+
},
|
3308
|
+
assert: function() {
|
3309
|
+
this.runWithStub.apply(this, arguments);
|
3310
|
+
QUnit.ok(this.sawCall, "Expected "+this.property+" to be called.");
|
3311
|
+
}
|
3312
|
+
};
|
3313
|
+
|
3314
|
+
__exports__["default"] = MethodCallExpectation;
|
3315
|
+
});
|
3316
|
+
enifed("ember-dev/test-helper/remaining-template",
|
3317
|
+
["exports"],
|
3318
|
+
function(__exports__) {
|
3319
|
+
"use strict";
|
3320
|
+
/* globals QUnit */
|
3321
|
+
|
3322
|
+
var RemainingTemplateAssert = function(env){
|
3323
|
+
this.env = env;
|
3324
|
+
};
|
3325
|
+
|
3326
|
+
RemainingTemplateAssert.prototype = {
|
3327
|
+
reset: function(){},
|
3328
|
+
inject: function(){},
|
3329
|
+
assert: function(){
|
3330
|
+
if (this.env.Ember && this.env.Ember.TEMPLATES) {
|
3331
|
+
var templateNames = [], name;
|
3332
|
+
for (name in this.env.Ember.TEMPLATES) {
|
3333
|
+
if (this.env.Ember.TEMPLATES[name] != null) {
|
3334
|
+
templateNames.push(name);
|
3335
|
+
}
|
3336
|
+
}
|
3337
|
+
|
3338
|
+
if (templateNames.length > 0) {
|
3339
|
+
QUnit.deepEqual(templateNames, [], "Ember.TEMPLATES should be empty");
|
3340
|
+
this.env.Ember.TEMPLATES = {};
|
3341
|
+
}
|
3342
|
+
}
|
3343
|
+
},
|
3344
|
+
restore: function(){}
|
3345
|
+
};
|
3346
|
+
|
3347
|
+
__exports__["default"] = RemainingTemplateAssert;
|
3348
|
+
});
|
3349
|
+
enifed("ember-dev/test-helper/remaining-view",
|
3350
|
+
["exports"],
|
3351
|
+
function(__exports__) {
|
3352
|
+
"use strict";
|
3353
|
+
/* globals QUnit */
|
3354
|
+
|
3355
|
+
var RemainingViewAssert = function(env){
|
3356
|
+
this.env = env;
|
3357
|
+
};
|
3358
|
+
|
3359
|
+
RemainingViewAssert.prototype = {
|
3360
|
+
reset: function(){},
|
3361
|
+
inject: function(){},
|
3362
|
+
assert: function(){
|
3363
|
+
if (this.env.Ember && this.env.Ember.View) {
|
3364
|
+
var viewIds = [], id;
|
3365
|
+
for (id in this.env.Ember.View.views) {
|
3366
|
+
if (this.env.Ember.View.views[id] != null) {
|
3367
|
+
viewIds.push(id);
|
3368
|
+
}
|
3369
|
+
}
|
3370
|
+
|
3371
|
+
if (viewIds.length > 0) {
|
3372
|
+
QUnit.deepEqual(viewIds, [], "Ember.View.views should be empty");
|
3373
|
+
this.env.Ember.View.views = [];
|
3374
|
+
}
|
3375
|
+
}
|
3376
|
+
},
|
3377
|
+
restore: function(){}
|
3378
|
+
};
|
3379
|
+
|
3380
|
+
__exports__["default"] = RemainingViewAssert;
|
3381
|
+
});
|
3382
|
+
enifed("ember-dev/test-helper/run-loop",
|
3383
|
+
["exports"],
|
3384
|
+
function(__exports__) {
|
3385
|
+
"use strict";
|
3386
|
+
/* globals QUnit */
|
3387
|
+
|
3388
|
+
function RunLoopAssertion(env){
|
3389
|
+
this.env = env;
|
3390
|
+
}
|
3391
|
+
|
3392
|
+
RunLoopAssertion.prototype = {
|
3393
|
+
reset: function(){},
|
3394
|
+
inject: function(){},
|
3395
|
+
assert: function(){
|
3396
|
+
var run = this.env.Ember.run;
|
3397
|
+
|
3398
|
+
if (run.currentRunLoop) {
|
3399
|
+
QUnit.ok(false, "Should not be in a run loop at end of test");
|
3400
|
+
while (run.currentRunLoop) {
|
3401
|
+
run.end();
|
3402
|
+
}
|
3403
|
+
}
|
3404
|
+
|
3405
|
+
if (run.hasScheduledTimers()) {
|
3406
|
+
QUnit.ok(false, "Ember run should not have scheduled timers at end of test");
|
3407
|
+
run.cancelTimers();
|
3408
|
+
}
|
3409
|
+
},
|
3410
|
+
restore: function(){}
|
3411
|
+
};
|
3412
|
+
|
3413
|
+
__exports__["default"] = RunLoopAssertion;
|
3414
|
+
});
|
3415
|
+
enifed("ember-dev/test-helper/setup-qunit",
|
3416
|
+
["exports"],
|
3417
|
+
function(__exports__) {
|
3418
|
+
"use strict";
|
3419
|
+
/* globals QUnit */
|
3420
|
+
|
3421
|
+
__exports__["default"] = function setupQUnit(assertion, _qunitGlobal) {
|
3422
|
+
var qunitGlobal = QUnit;
|
3423
|
+
|
3424
|
+
if (_qunitGlobal) {
|
3425
|
+
qunitGlobal = _qunitGlobal;
|
3426
|
+
}
|
3427
|
+
|
3428
|
+
var originalModule = qunitGlobal.module;
|
3429
|
+
|
3430
|
+
qunitGlobal.module = function(name, _options) {
|
3431
|
+
var options = _options || {};
|
3432
|
+
var originalSetup = options.setup || function() { };
|
3433
|
+
var originalTeardown = options.teardown || function() { };
|
3434
|
+
|
3435
|
+
options.setup = function() {
|
3436
|
+
assertion.reset();
|
3437
|
+
assertion.inject();
|
3438
|
+
|
3439
|
+
originalSetup.call(this);
|
3440
|
+
};
|
3441
|
+
|
3442
|
+
options.teardown = function() {
|
3443
|
+
originalTeardown.call(this);
|
3444
|
+
|
3445
|
+
assertion.assert();
|
3446
|
+
assertion.restore();
|
3447
|
+
};
|
3448
|
+
|
3449
|
+
return originalModule(name, options);
|
3450
|
+
};
|
3451
|
+
}
|
3452
|
+
});
|
3453
|
+
enifed("ember-dev/test-helper/utils",
|
3454
|
+
["exports"],
|
3455
|
+
function(__exports__) {
|
3456
|
+
"use strict";
|
3457
|
+
function callForEach(prop, func) {
|
3458
|
+
return function() {
|
3459
|
+
for (var i=0, l=this[prop].length;i<l;i++) {
|
3460
|
+
this[prop][i][func]();
|
3461
|
+
}
|
3462
|
+
};
|
3463
|
+
}
|
3464
|
+
|
3465
|
+
function buildCompositeAssert(klasses){
|
3466
|
+
var Composite = function(emberKlass, runningProdBuild){
|
3467
|
+
this.asserts = [];
|
3468
|
+
for (var i=0, l=klasses.length;i<l;i++) {
|
3469
|
+
this.asserts.push(new klasses[i]({
|
3470
|
+
Ember: emberKlass,
|
3471
|
+
runningProdBuild: runningProdBuild
|
3472
|
+
}));
|
3473
|
+
}
|
3474
|
+
};
|
3475
|
+
|
3476
|
+
Composite.prototype = {
|
3477
|
+
reset: callForEach('asserts', 'reset'),
|
3478
|
+
inject: callForEach('asserts', 'inject'),
|
3479
|
+
assert: callForEach('asserts', 'assert'),
|
3480
|
+
restore: callForEach('asserts', 'restore')
|
3481
|
+
};
|
3482
|
+
|
3483
|
+
return Composite;
|
3484
|
+
}
|
3485
|
+
|
3486
|
+
__exports__.buildCompositeAssert = buildCompositeAssert;var o_create = Object.create || (function(){
|
3487
|
+
function F(){}
|
3488
|
+
|
3489
|
+
return function(o) {
|
3490
|
+
if (arguments.length !== 1) {
|
3491
|
+
throw new Error('Object.create implementation only accepts one parameter.');
|
3492
|
+
}
|
3493
|
+
F.prototype = o;
|
3494
|
+
return new F();
|
3495
|
+
};
|
3496
|
+
}());
|
3497
|
+
|
3498
|
+
var o_create;
|
3499
|
+
__exports__.o_create = o_create;
|
3500
|
+
});
|
2926
3501
|
enifed("ember-extension-support.jshint",
|
2927
3502
|
[],
|
2928
3503
|
function() {
|
@@ -3545,6 +4120,487 @@ enifed("ember-handlebars/string.jshint",
|
|
3545
4120
|
ok(true, 'ember-handlebars/string.js should pass jshint.');
|
3546
4121
|
});
|
3547
4122
|
});
|
4123
|
+
enifed("ember-handlebars/tests/bind_attr_test",
|
4124
|
+
["ember-metal/core","ember-metal/run_loop","ember-runtime/system/namespace","ember-views/views/view","ember-handlebars/views/metamorph_view","ember-handlebars","ember-runtime/system/object","ember-runtime/system/native_array","ember-metal/computed","ember-metal/observer","ember-runtime/system/container","ember-metal/property_set"],
|
4125
|
+
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__) {
|
4126
|
+
"use strict";
|
4127
|
+
/*jshint newcap:false*/
|
4128
|
+
var Ember = __dependency1__["default"];
|
4129
|
+
// Ember.lookup
|
4130
|
+
var run = __dependency2__["default"];
|
4131
|
+
var Namespace = __dependency3__["default"];
|
4132
|
+
var EmberView = __dependency4__["default"];
|
4133
|
+
var _MetamorphView = __dependency5__["default"];
|
4134
|
+
var EmberHandlebars = __dependency6__["default"];
|
4135
|
+
var EmberObject = __dependency7__["default"];
|
4136
|
+
var A = __dependency8__.A;
|
4137
|
+
var computed = __dependency9__.computed;
|
4138
|
+
var observersFor = __dependency10__.observersFor;
|
4139
|
+
var Container = __dependency11__["default"];
|
4140
|
+
var set = __dependency12__.set;
|
4141
|
+
|
4142
|
+
var view;
|
4143
|
+
|
4144
|
+
var appendView = function() {
|
4145
|
+
run(function() { view.appendTo('#qunit-fixture'); });
|
4146
|
+
};
|
4147
|
+
|
4148
|
+
var originalLookup = Ember.lookup;
|
4149
|
+
var TemplateTests, container, lookup;
|
4150
|
+
|
4151
|
+
/**
|
4152
|
+
This module specifically tests integration with Handlebars and Ember-specific
|
4153
|
+
Handlebars extensions.
|
4154
|
+
|
4155
|
+
If you add additional template support to View, you should create a new
|
4156
|
+
file in which to test.
|
4157
|
+
*/
|
4158
|
+
QUnit.module("View - handlebars integration", {
|
4159
|
+
setup: function() {
|
4160
|
+
Ember.lookup = lookup = {};
|
4161
|
+
lookup.TemplateTests = TemplateTests = Namespace.create();
|
4162
|
+
container = new Container();
|
4163
|
+
container.optionsForType('template', { instantiate: false });
|
4164
|
+
container.register('view:default', _MetamorphView);
|
4165
|
+
container.register('view:toplevel', EmberView.extend());
|
4166
|
+
},
|
4167
|
+
|
4168
|
+
teardown: function() {
|
4169
|
+
run(function() {
|
4170
|
+
if (container) {
|
4171
|
+
container.destroy();
|
4172
|
+
}
|
4173
|
+
if (view) {
|
4174
|
+
view.destroy();
|
4175
|
+
}
|
4176
|
+
container = view = null;
|
4177
|
+
});
|
4178
|
+
Ember.lookup = lookup = originalLookup;
|
4179
|
+
TemplateTests = null;
|
4180
|
+
}
|
4181
|
+
});
|
4182
|
+
|
4183
|
+
test("should be able to bind element attributes using {{bind-attr}}", function() {
|
4184
|
+
var template = EmberHandlebars.compile('<img {{bind-attr src="view.content.url" alt="view.content.title"}}>');
|
4185
|
+
|
4186
|
+
view = EmberView.create({
|
4187
|
+
template: template,
|
4188
|
+
content: EmberObject.create({
|
4189
|
+
url: "http://www.emberjs.com/assets/images/logo.png",
|
4190
|
+
title: "The SproutCore Logo"
|
4191
|
+
})
|
4192
|
+
});
|
4193
|
+
|
4194
|
+
appendView();
|
4195
|
+
|
4196
|
+
equal(view.$('img').attr('src'), "http://www.emberjs.com/assets/images/logo.png", "sets src attribute");
|
4197
|
+
equal(view.$('img').attr('alt'), "The SproutCore Logo", "sets alt attribute");
|
4198
|
+
|
4199
|
+
run(function() {
|
4200
|
+
set(view, 'content.title', "El logo de Eember");
|
4201
|
+
});
|
4202
|
+
|
4203
|
+
equal(view.$('img').attr('alt'), "El logo de Eember", "updates alt attribute when content's title attribute changes");
|
4204
|
+
|
4205
|
+
run(function() {
|
4206
|
+
set(view, 'content', EmberObject.create({
|
4207
|
+
url: "http://www.thegooglez.com/theydonnothing",
|
4208
|
+
title: "I CAN HAZ SEARCH"
|
4209
|
+
}));
|
4210
|
+
});
|
4211
|
+
|
4212
|
+
equal(view.$('img').attr('alt'), "I CAN HAZ SEARCH", "updates alt attribute when content object changes");
|
4213
|
+
|
4214
|
+
run(function() {
|
4215
|
+
set(view, 'content', {
|
4216
|
+
url: "http://www.emberjs.com/assets/images/logo.png",
|
4217
|
+
title: "The SproutCore Logo"
|
4218
|
+
});
|
4219
|
+
});
|
4220
|
+
|
4221
|
+
equal(view.$('img').attr('alt'), "The SproutCore Logo", "updates alt attribute when content object is a hash");
|
4222
|
+
|
4223
|
+
run(function() {
|
4224
|
+
set(view, 'content', EmberObject.createWithMixins({
|
4225
|
+
url: "http://www.emberjs.com/assets/images/logo.png",
|
4226
|
+
title: computed(function() {
|
4227
|
+
return "Nanananana Ember!";
|
4228
|
+
})
|
4229
|
+
}));
|
4230
|
+
});
|
4231
|
+
|
4232
|
+
equal(view.$('img').attr('alt'), "Nanananana Ember!", "updates alt attribute when title property is computed");
|
4233
|
+
});
|
4234
|
+
|
4235
|
+
test("should be able to bind to view attributes with {{bind-attr}}", function() {
|
4236
|
+
view = EmberView.create({
|
4237
|
+
value: 'Test',
|
4238
|
+
template: EmberHandlebars.compile('<img src="test.jpg" {{bind-attr alt="view.value"}}>')
|
4239
|
+
});
|
4240
|
+
|
4241
|
+
appendView();
|
4242
|
+
|
4243
|
+
equal(view.$('img').attr('alt'), "Test", "renders initial value");
|
4244
|
+
|
4245
|
+
run(function() {
|
4246
|
+
view.set('value', 'Updated');
|
4247
|
+
});
|
4248
|
+
|
4249
|
+
equal(view.$('img').attr('alt'), "Updated", "updates value");
|
4250
|
+
});
|
4251
|
+
|
4252
|
+
test("should be able to bind to globals with {{bind-attr}} (DEPRECATED)", function() {
|
4253
|
+
TemplateTests.set('value', 'Test');
|
4254
|
+
|
4255
|
+
view = EmberView.create({
|
4256
|
+
template: EmberHandlebars.compile('<img src="test.jpg" {{bind-attr alt="TemplateTests.value"}}>')
|
4257
|
+
});
|
4258
|
+
|
4259
|
+
expectDeprecation(function(){
|
4260
|
+
appendView();
|
4261
|
+
}, /Global lookup of TemplateTests.value from a Handlebars template is deprecated/);
|
4262
|
+
|
4263
|
+
equal(view.$('img').attr('alt'), "Test", "renders initial value");
|
4264
|
+
});
|
4265
|
+
|
4266
|
+
test("should not allow XSS injection via {{bind-attr}}", function() {
|
4267
|
+
view = EmberView.create({
|
4268
|
+
template: EmberHandlebars.compile('<img src="test.jpg" {{bind-attr alt="view.content.value"}}>'),
|
4269
|
+
content: {
|
4270
|
+
value: 'Trololol" onmouseover="alert(\'HAX!\');'
|
4271
|
+
}
|
4272
|
+
});
|
4273
|
+
|
4274
|
+
appendView();
|
4275
|
+
|
4276
|
+
equal(view.$('img').attr('onmouseover'), undefined);
|
4277
|
+
// If the whole string is here, then it means we got properly escaped
|
4278
|
+
equal(view.$('img').attr('alt'), 'Trololol" onmouseover="alert(\'HAX!\');');
|
4279
|
+
});
|
4280
|
+
|
4281
|
+
test("should be able to bind use {{bind-attr}} more than once on an element", function() {
|
4282
|
+
var template = EmberHandlebars.compile('<img {{bind-attr src="view.content.url"}} {{bind-attr alt="view.content.title"}}>');
|
4283
|
+
|
4284
|
+
view = EmberView.create({
|
4285
|
+
template: template,
|
4286
|
+
content: EmberObject.create({
|
4287
|
+
url: "http://www.emberjs.com/assets/images/logo.png",
|
4288
|
+
title: "The SproutCore Logo"
|
4289
|
+
})
|
4290
|
+
});
|
4291
|
+
|
4292
|
+
appendView();
|
4293
|
+
|
4294
|
+
equal(view.$('img').attr('src'), "http://www.emberjs.com/assets/images/logo.png", "sets src attribute");
|
4295
|
+
equal(view.$('img').attr('alt'), "The SproutCore Logo", "sets alt attribute");
|
4296
|
+
|
4297
|
+
run(function() {
|
4298
|
+
set(view, 'content.title', "El logo de Eember");
|
4299
|
+
});
|
4300
|
+
|
4301
|
+
equal(view.$('img').attr('alt'), "El logo de Eember", "updates alt attribute when content's title attribute changes");
|
4302
|
+
|
4303
|
+
run(function() {
|
4304
|
+
set(view, 'content', EmberObject.create({
|
4305
|
+
url: "http://www.thegooglez.com/theydonnothing",
|
4306
|
+
title: "I CAN HAZ SEARCH"
|
4307
|
+
}));
|
4308
|
+
});
|
4309
|
+
|
4310
|
+
equal(view.$('img').attr('alt'), "I CAN HAZ SEARCH", "updates alt attribute when content object changes");
|
4311
|
+
|
4312
|
+
run(function() {
|
4313
|
+
set(view, 'content', {
|
4314
|
+
url: "http://www.emberjs.com/assets/images/logo.png",
|
4315
|
+
title: "The SproutCore Logo"
|
4316
|
+
});
|
4317
|
+
});
|
4318
|
+
|
4319
|
+
equal(view.$('img').attr('alt'), "The SproutCore Logo", "updates alt attribute when content object is a hash");
|
4320
|
+
|
4321
|
+
run(function() {
|
4322
|
+
set(view, 'content', EmberObject.createWithMixins({
|
4323
|
+
url: "http://www.emberjs.com/assets/images/logo.png",
|
4324
|
+
title: computed(function() {
|
4325
|
+
return "Nanananana Ember!";
|
4326
|
+
})
|
4327
|
+
}));
|
4328
|
+
});
|
4329
|
+
|
4330
|
+
equal(view.$('img').attr('alt'), "Nanananana Ember!", "updates alt attribute when title property is computed");
|
4331
|
+
|
4332
|
+
});
|
4333
|
+
|
4334
|
+
test("{{bindAttr}} is aliased to {{bind-attr}}", function() {
|
4335
|
+
expect(4);
|
4336
|
+
|
4337
|
+
var originalBindAttr = EmberHandlebars.helpers['bind-attr'];
|
4338
|
+
|
4339
|
+
try {
|
4340
|
+
EmberHandlebars.helpers['bind-attr'] = function() {
|
4341
|
+
equal(arguments[0], 'foo', 'First arg match');
|
4342
|
+
equal(arguments[1], 'bar', 'Second arg match');
|
4343
|
+
|
4344
|
+
return 'result';
|
4345
|
+
};
|
4346
|
+
|
4347
|
+
expectDeprecation(function() {
|
4348
|
+
var result = EmberHandlebars.helpers.bindAttr('foo', 'bar');
|
4349
|
+
equal(result, 'result', 'Result match');
|
4350
|
+
}, "The 'bindAttr' view helper is deprecated in favor of 'bind-attr'");
|
4351
|
+
} finally {
|
4352
|
+
EmberHandlebars.helpers['bind-attr'] = originalBindAttr;
|
4353
|
+
}
|
4354
|
+
});
|
4355
|
+
|
4356
|
+
test("should be able to bind element attributes using {{bind-attr}} inside a block", function() {
|
4357
|
+
var template = EmberHandlebars.compile('{{#with view.content as image}}<img {{bind-attr src=image.url alt=image.title}}>{{/with}}');
|
4358
|
+
|
4359
|
+
view = EmberView.create({
|
4360
|
+
template: template,
|
4361
|
+
content: EmberObject.create({
|
4362
|
+
url: "http://www.emberjs.com/assets/images/logo.png",
|
4363
|
+
title: "The SproutCore Logo"
|
4364
|
+
})
|
4365
|
+
});
|
4366
|
+
|
4367
|
+
appendView();
|
4368
|
+
|
4369
|
+
equal(view.$('img').attr('src'), "http://www.emberjs.com/assets/images/logo.png", "sets src attribute");
|
4370
|
+
equal(view.$('img').attr('alt'), "The SproutCore Logo", "sets alt attribute");
|
4371
|
+
|
4372
|
+
run(function() {
|
4373
|
+
set(view, 'content.title', "El logo de Eember");
|
4374
|
+
});
|
4375
|
+
|
4376
|
+
equal(view.$('img').attr('alt'), "El logo de Eember", "updates alt attribute when content's title attribute changes");
|
4377
|
+
});
|
4378
|
+
|
4379
|
+
test("should be able to bind class attribute with {{bind-attr}}", function() {
|
4380
|
+
var template = EmberHandlebars.compile('<img {{bind-attr class="view.foo"}}>');
|
4381
|
+
|
4382
|
+
view = EmberView.create({
|
4383
|
+
template: template,
|
4384
|
+
foo: 'bar'
|
4385
|
+
});
|
4386
|
+
|
4387
|
+
appendView();
|
4388
|
+
|
4389
|
+
equal(view.$('img').attr('class'), 'bar', "renders class");
|
4390
|
+
|
4391
|
+
run(function() {
|
4392
|
+
set(view, 'foo', 'baz');
|
4393
|
+
});
|
4394
|
+
|
4395
|
+
equal(view.$('img').attr('class'), 'baz', "updates class");
|
4396
|
+
});
|
4397
|
+
|
4398
|
+
test("should be able to bind class attribute via a truthy property with {{bind-attr}}", function() {
|
4399
|
+
var template = EmberHandlebars.compile('<img {{bind-attr class="view.isNumber:is-truthy"}}>');
|
4400
|
+
|
4401
|
+
view = EmberView.create({
|
4402
|
+
template: template,
|
4403
|
+
isNumber: 5
|
4404
|
+
});
|
4405
|
+
|
4406
|
+
appendView();
|
4407
|
+
|
4408
|
+
equal(view.$('.is-truthy').length, 1, "sets class name");
|
4409
|
+
|
4410
|
+
run(function() {
|
4411
|
+
set(view, 'isNumber', 0);
|
4412
|
+
});
|
4413
|
+
|
4414
|
+
equal(view.$('.is-truthy').length, 0, "removes class name if bound property is set to something non-truthy");
|
4415
|
+
});
|
4416
|
+
|
4417
|
+
test("should be able to bind class to view attribute with {{bind-attr}}", function() {
|
4418
|
+
var template = EmberHandlebars.compile('<img {{bind-attr class="view.foo"}}>');
|
4419
|
+
|
4420
|
+
view = EmberView.create({
|
4421
|
+
template: template,
|
4422
|
+
foo: 'bar'
|
4423
|
+
});
|
4424
|
+
|
4425
|
+
appendView();
|
4426
|
+
|
4427
|
+
equal(view.$('img').attr('class'), 'bar', "renders class");
|
4428
|
+
|
4429
|
+
run(function() {
|
4430
|
+
set(view, 'foo', 'baz');
|
4431
|
+
});
|
4432
|
+
|
4433
|
+
equal(view.$('img').attr('class'), 'baz', "updates class");
|
4434
|
+
});
|
4435
|
+
|
4436
|
+
test("should not allow XSS injection via {{bind-attr}} with class", function() {
|
4437
|
+
view = EmberView.create({
|
4438
|
+
template: EmberHandlebars.compile('<img {{bind-attr class="view.foo"}}>'),
|
4439
|
+
foo: '" onmouseover="alert(\'I am in your classes hacking your app\');'
|
4440
|
+
});
|
4441
|
+
|
4442
|
+
appendView();
|
4443
|
+
|
4444
|
+
equal(view.$('img').attr('onmouseover'), undefined);
|
4445
|
+
// If the whole string is here, then it means we got properly escaped
|
4446
|
+
equal(view.$('img').attr('class'), '" onmouseover="alert(\'I am in your classes hacking your app\');');
|
4447
|
+
});
|
4448
|
+
|
4449
|
+
test("should be able to bind class attribute using ternary operator in {{bind-attr}}", function() {
|
4450
|
+
var template = EmberHandlebars.compile('<img {{bind-attr class="view.content.isDisabled:disabled:enabled"}} />');
|
4451
|
+
var content = EmberObject.create({
|
4452
|
+
isDisabled: true
|
4453
|
+
});
|
4454
|
+
|
4455
|
+
view = EmberView.create({
|
4456
|
+
template: template,
|
4457
|
+
content: content
|
4458
|
+
});
|
4459
|
+
|
4460
|
+
appendView();
|
4461
|
+
|
4462
|
+
ok(view.$('img').hasClass('disabled'), 'disabled class is rendered');
|
4463
|
+
ok(!view.$('img').hasClass('enabled'), 'enabled class is not rendered');
|
4464
|
+
|
4465
|
+
run(function() {
|
4466
|
+
set(content, 'isDisabled', false);
|
4467
|
+
});
|
4468
|
+
|
4469
|
+
ok(!view.$('img').hasClass('disabled'), 'disabled class is not rendered');
|
4470
|
+
ok(view.$('img').hasClass('enabled'), 'enabled class is rendered');
|
4471
|
+
});
|
4472
|
+
|
4473
|
+
test("should be able to add multiple classes using {{bind-attr class}}", function() {
|
4474
|
+
var template = EmberHandlebars.compile('<div {{bind-attr class="view.content.isAwesomeSauce view.content.isAlsoCool view.content.isAmazing:amazing :is-super-duper view.content.isEnabled:enabled:disabled"}}></div>');
|
4475
|
+
var content = EmberObject.create({
|
4476
|
+
isAwesomeSauce: true,
|
4477
|
+
isAlsoCool: true,
|
4478
|
+
isAmazing: true,
|
4479
|
+
isEnabled: true
|
4480
|
+
});
|
4481
|
+
|
4482
|
+
view = EmberView.create({
|
4483
|
+
template: template,
|
4484
|
+
content: content
|
4485
|
+
});
|
4486
|
+
|
4487
|
+
appendView();
|
4488
|
+
|
4489
|
+
ok(view.$('div').hasClass('is-awesome-sauce'), "dasherizes first property and sets classname");
|
4490
|
+
ok(view.$('div').hasClass('is-also-cool'), "dasherizes second property and sets classname");
|
4491
|
+
ok(view.$('div').hasClass('amazing'), "uses alias for third property and sets classname");
|
4492
|
+
ok(view.$('div').hasClass('is-super-duper'), "static class is present");
|
4493
|
+
ok(view.$('div').hasClass('enabled'), "truthy class in ternary classname definition is rendered");
|
4494
|
+
ok(!view.$('div').hasClass('disabled'), "falsy class in ternary classname definition is not rendered");
|
4495
|
+
|
4496
|
+
run(function() {
|
4497
|
+
set(content, 'isAwesomeSauce', false);
|
4498
|
+
set(content, 'isAmazing', false);
|
4499
|
+
set(content, 'isEnabled', false);
|
4500
|
+
});
|
4501
|
+
|
4502
|
+
ok(!view.$('div').hasClass('is-awesome-sauce'), "removes dasherized class when property is set to false");
|
4503
|
+
ok(!view.$('div').hasClass('amazing'), "removes aliased class when property is set to false");
|
4504
|
+
ok(view.$('div').hasClass('is-super-duper'), "static class is still present");
|
4505
|
+
ok(!view.$('div').hasClass('enabled'), "truthy class in ternary classname definition is not rendered");
|
4506
|
+
ok(view.$('div').hasClass('disabled'), "falsy class in ternary classname definition is rendered");
|
4507
|
+
});
|
4508
|
+
|
4509
|
+
test("should be able to bind classes to globals with {{bind-attr class}} (DEPRECATED)", function() {
|
4510
|
+
TemplateTests.set('isOpen', true);
|
4511
|
+
|
4512
|
+
view = EmberView.create({
|
4513
|
+
template: EmberHandlebars.compile('<img src="test.jpg" {{bind-attr class="TemplateTests.isOpen"}}>')
|
4514
|
+
});
|
4515
|
+
|
4516
|
+
expectDeprecation(function(){
|
4517
|
+
appendView();
|
4518
|
+
}, /Global lookup of TemplateTests.isOpen from a Handlebars template is deprecated/);
|
4519
|
+
|
4520
|
+
ok(view.$('img').hasClass('is-open'), "sets classname to the dasherized value of the global property");
|
4521
|
+
});
|
4522
|
+
|
4523
|
+
test("should be able to bind-attr to 'this' in an {{#each}} block [DEPRECATED]", function() {
|
4524
|
+
expectDeprecation('Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each foo in bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
4525
|
+
|
4526
|
+
view = EmberView.create({
|
4527
|
+
template: EmberHandlebars.compile('{{#each view.images}}<img {{bind-attr src="this"}}>{{/each}}'),
|
4528
|
+
images: A(['one.png', 'two.jpg', 'three.gif'])
|
4529
|
+
});
|
4530
|
+
|
4531
|
+
appendView();
|
4532
|
+
|
4533
|
+
var images = view.$('img');
|
4534
|
+
ok(/one\.png$/.test(images[0].src));
|
4535
|
+
ok(/two\.jpg$/.test(images[1].src));
|
4536
|
+
ok(/three\.gif$/.test(images[2].src));
|
4537
|
+
});
|
4538
|
+
|
4539
|
+
test("should be able to bind classes to 'this' in an {{#each}} block with {{bind-attr class}} [DEPRECATED]", function() {
|
4540
|
+
expectDeprecation('Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each foo in bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
4541
|
+
|
4542
|
+
view = EmberView.create({
|
4543
|
+
template: EmberHandlebars.compile('{{#each view.items}}<li {{bind-attr class="this"}}>Item</li>{{/each}}'),
|
4544
|
+
items: A(['a', 'b', 'c'])
|
4545
|
+
});
|
4546
|
+
|
4547
|
+
appendView();
|
4548
|
+
|
4549
|
+
ok(view.$('li').eq(0).hasClass('a'), "sets classname to the value of the first item");
|
4550
|
+
ok(view.$('li').eq(1).hasClass('b'), "sets classname to the value of the second item");
|
4551
|
+
ok(view.$('li').eq(2).hasClass('c'), "sets classname to the value of the third item");
|
4552
|
+
});
|
4553
|
+
|
4554
|
+
test("should be able to bind-attr to var in {{#each var in list}} block", function() {
|
4555
|
+
view = EmberView.create({
|
4556
|
+
template: EmberHandlebars.compile('{{#each image in view.images}}<img {{bind-attr src="image"}}>{{/each}}'),
|
4557
|
+
images: A(['one.png', 'two.jpg', 'three.gif'])
|
4558
|
+
});
|
4559
|
+
|
4560
|
+
appendView();
|
4561
|
+
|
4562
|
+
var images = view.$('img');
|
4563
|
+
ok(/one\.png$/.test(images[0].src));
|
4564
|
+
ok(/two\.jpg$/.test(images[1].src));
|
4565
|
+
ok(/three\.gif$/.test(images[2].src));
|
4566
|
+
|
4567
|
+
run(function() {
|
4568
|
+
var imagesArray = view.get('images');
|
4569
|
+
imagesArray.removeAt(0);
|
4570
|
+
});
|
4571
|
+
|
4572
|
+
images = view.$('img');
|
4573
|
+
ok(images.length === 2, "");
|
4574
|
+
ok(/two\.jpg$/.test(images[0].src));
|
4575
|
+
ok(/three\.gif$/.test(images[1].src));
|
4576
|
+
});
|
4577
|
+
|
4578
|
+
test("should teardown observers from bind-attr on rerender", function() {
|
4579
|
+
view = EmberView.create({
|
4580
|
+
template: EmberHandlebars.compile('<span {{bind-attr class="view.foo" name="view.foo"}}>wat</span>'),
|
4581
|
+
foo: 'bar'
|
4582
|
+
});
|
4583
|
+
|
4584
|
+
appendView();
|
4585
|
+
|
4586
|
+
equal(observersFor(view, 'foo').length, 1);
|
4587
|
+
|
4588
|
+
run(function() {
|
4589
|
+
view.rerender();
|
4590
|
+
});
|
4591
|
+
|
4592
|
+
equal(observersFor(view, 'foo').length, 1);
|
4593
|
+
});
|
4594
|
+
});
|
4595
|
+
enifed("ember-handlebars/tests/bind_attr_test.jshint",
|
4596
|
+
[],
|
4597
|
+
function() {
|
4598
|
+
"use strict";
|
4599
|
+
module('JSHint - ember-handlebars/tests');
|
4600
|
+
test('ember-handlebars/tests/bind_attr_test.js should pass jshint', function() {
|
4601
|
+
ok(true, 'ember-handlebars/tests/bind_attr_test.js should pass jshint.');
|
4602
|
+
});
|
4603
|
+
});
|
3548
4604
|
enifed("ember-handlebars/tests/controls/checkbox_test",
|
3549
4605
|
["ember-metal/property_get","ember-metal/property_set","ember-metal/run_loop","ember-views/views/view","ember-views/system/event_dispatcher","ember-handlebars-compiler"],
|
3550
4606
|
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__) {
|
@@ -6032,7 +7088,7 @@ enifed("ember-handlebars/tests/handlebars_test",
|
|
6032
7088
|
|
6033
7089
|
test("should allow values from normal JavaScript hash objects to be used", function() {
|
6034
7090
|
view = EmberView.create({
|
6035
|
-
template: EmberHandlebars.compile('{{#with view.person}}{{firstName}} {{lastName}} (and {{pet.name}}){{/with}}'),
|
7091
|
+
template: EmberHandlebars.compile('{{#with view.person as person}}{{person.firstName}} {{person.lastName}} (and {{person.pet.name}}){{/with}}'),
|
6036
7092
|
|
6037
7093
|
person: {
|
6038
7094
|
firstName: 'Señor',
|
@@ -6247,7 +7303,7 @@ enifed("ember-handlebars/tests/handlebars_test",
|
|
6247
7303
|
|
6248
7304
|
test("child views can be inserted inside a bind block", function() {
|
6249
7305
|
container.register('template:nester', EmberHandlebars.compile("<h1 id='hello-world'>Hello {{world}}</h1>{{view view.bqView}}"));
|
6250
|
-
container.register('template:nested', EmberHandlebars.compile("<div id='child-view'>Goodbye {{#with content}}{{blah}} {{view view.otherView}}{{/with}} {{world}}</div>"));
|
7306
|
+
container.register('template:nested', EmberHandlebars.compile("<div id='child-view'>Goodbye {{#with content as thing}}{{thing.blah}} {{view view.otherView}}{{/with}} {{world}}</div>"));
|
6251
7307
|
container.register('template:other', EmberHandlebars.compile("cruel"));
|
6252
7308
|
|
6253
7309
|
var context = {
|
@@ -6298,7 +7354,7 @@ enifed("ember-handlebars/tests/handlebars_test",
|
|
6298
7354
|
});
|
6299
7355
|
|
6300
7356
|
test("View should update when a property changes and the bind helper is used", function() {
|
6301
|
-
container.register('template:foo', EmberHandlebars.compile('<h1 id="first">{{#with view.content}}{{bind "wham"}}{{/with}}</h1>'));
|
7357
|
+
container.register('template:foo', EmberHandlebars.compile('<h1 id="first">{{#with view.content as thing}}{{bind "thing.wham"}}{{/with}}</h1>'));
|
6302
7358
|
|
6303
7359
|
view = EmberView.create({
|
6304
7360
|
container: container,
|
@@ -6338,7 +7394,7 @@ enifed("ember-handlebars/tests/handlebars_test",
|
|
6338
7394
|
});
|
6339
7395
|
|
6340
7396
|
test("View should update when a property changes and no bind helper is used", function() {
|
6341
|
-
container.register('template:foo', EmberHandlebars.compile('<h1 id="first">{{#with view.content}}{{wham}}{{/with}}</h1>'));
|
7397
|
+
container.register('template:foo', EmberHandlebars.compile('<h1 id="first">{{#with view.content as thing}}{{thing.wham}}{{/with}}</h1>'));
|
6342
7398
|
|
6343
7399
|
view = EmberView.create({
|
6344
7400
|
container: container,
|
@@ -6359,7 +7415,7 @@ enifed("ember-handlebars/tests/handlebars_test",
|
|
6359
7415
|
equal(view.$('#first').text(), "bazam", "view updates when a bound property changes");
|
6360
7416
|
});
|
6361
7417
|
|
6362
|
-
test("View should update when the property used with the #with helper changes", function() {
|
7418
|
+
test("View should update when the property used with the #with helper changes [DEPRECATED]", function() {
|
6363
7419
|
container.register('template:foo', EmberHandlebars.compile('<h1 id="first">{{#with view.content}}{{wham}}{{/with}}</h1>'));
|
6364
7420
|
|
6365
7421
|
view = EmberView.create({
|
@@ -6372,7 +7428,9 @@ enifed("ember-handlebars/tests/handlebars_test",
|
|
6372
7428
|
})
|
6373
7429
|
});
|
6374
7430
|
|
6375
|
-
|
7431
|
+
expectDeprecation(function() {
|
7432
|
+
appendView();
|
7433
|
+
}, 'Using the context switching form of `{{with}}` is deprecated. Please use the keyword form (`{{with foo as bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
6376
7434
|
|
6377
7435
|
equal(view.$('#first').text(), "bam", "precond - view renders Handlebars template");
|
6378
7436
|
|
@@ -6728,7 +7786,7 @@ enifed("ember-handlebars/tests/handlebars_test",
|
|
6728
7786
|
});
|
6729
7787
|
|
6730
7788
|
test("views render their template in the context of the parent view's context", function() {
|
6731
|
-
container.register('template:parent', EmberHandlebars.compile('<h1>{{#with content}}{{#view}}{{firstName}} {{lastName}}{{/view}}{{/with}}</h1>'));
|
7789
|
+
container.register('template:parent', EmberHandlebars.compile('<h1>{{#with content as person}}{{#view}}{{person.firstName}} {{person.lastName}}{{/view}}{{/with}}</h1>'));
|
6732
7790
|
|
6733
7791
|
var context = {
|
6734
7792
|
content: {
|
@@ -6748,7 +7806,7 @@ enifed("ember-handlebars/tests/handlebars_test",
|
|
6748
7806
|
});
|
6749
7807
|
|
6750
7808
|
test("views make a view keyword available that allows template to reference view context", function() {
|
6751
|
-
container.register('template:parent', EmberHandlebars.compile('<h1>{{#with view.content}}{{#view subview}}{{view.firstName}} {{lastName}}{{/view}}{{/with}}</h1>'));
|
7809
|
+
container.register('template:parent', EmberHandlebars.compile('<h1>{{#with view.content as person}}{{#view person.subview}}{{view.firstName}} {{person.lastName}}{{/view}}{{/with}}</h1>'));
|
6752
7810
|
|
6753
7811
|
view = EmberView.create({
|
6754
7812
|
container: container,
|
@@ -7281,179 +8339,6 @@ enifed("ember-handlebars/tests/handlebars_test",
|
|
7281
8339
|
equal(view.$('.is-falsy').length, 1, "sets class name to falsy value");
|
7282
8340
|
});
|
7283
8341
|
|
7284
|
-
test("should be able to bind element attributes using {{bind-attr}}", function() {
|
7285
|
-
var template = EmberHandlebars.compile('<img {{bind-attr src="view.content.url" alt="view.content.title"}}>');
|
7286
|
-
|
7287
|
-
view = EmberView.create({
|
7288
|
-
template: template,
|
7289
|
-
content: EmberObject.create({
|
7290
|
-
url: "http://www.emberjs.com/assets/images/logo.png",
|
7291
|
-
title: "The SproutCore Logo"
|
7292
|
-
})
|
7293
|
-
});
|
7294
|
-
|
7295
|
-
appendView();
|
7296
|
-
|
7297
|
-
equal(view.$('img').attr('src'), "http://www.emberjs.com/assets/images/logo.png", "sets src attribute");
|
7298
|
-
equal(view.$('img').attr('alt'), "The SproutCore Logo", "sets alt attribute");
|
7299
|
-
|
7300
|
-
run(function() {
|
7301
|
-
set(view, 'content.title', "El logo de Eember");
|
7302
|
-
});
|
7303
|
-
|
7304
|
-
equal(view.$('img').attr('alt'), "El logo de Eember", "updates alt attribute when content's title attribute changes");
|
7305
|
-
|
7306
|
-
run(function() {
|
7307
|
-
set(view, 'content', EmberObject.create({
|
7308
|
-
url: "http://www.thegooglez.com/theydonnothing",
|
7309
|
-
title: "I CAN HAZ SEARCH"
|
7310
|
-
}));
|
7311
|
-
});
|
7312
|
-
|
7313
|
-
equal(view.$('img').attr('alt'), "I CAN HAZ SEARCH", "updates alt attribute when content object changes");
|
7314
|
-
|
7315
|
-
run(function() {
|
7316
|
-
set(view, 'content', {
|
7317
|
-
url: "http://www.emberjs.com/assets/images/logo.png",
|
7318
|
-
title: "The SproutCore Logo"
|
7319
|
-
});
|
7320
|
-
});
|
7321
|
-
|
7322
|
-
equal(view.$('img').attr('alt'), "The SproutCore Logo", "updates alt attribute when content object is a hash");
|
7323
|
-
|
7324
|
-
run(function() {
|
7325
|
-
set(view, 'content', EmberObject.createWithMixins({
|
7326
|
-
url: "http://www.emberjs.com/assets/images/logo.png",
|
7327
|
-
title: computed(function() {
|
7328
|
-
return "Nanananana Ember!";
|
7329
|
-
})
|
7330
|
-
}));
|
7331
|
-
});
|
7332
|
-
|
7333
|
-
equal(view.$('img').attr('alt'), "Nanananana Ember!", "updates alt attribute when title property is computed");
|
7334
|
-
});
|
7335
|
-
|
7336
|
-
test("should be able to bind to view attributes with {{bind-attr}}", function() {
|
7337
|
-
view = EmberView.create({
|
7338
|
-
value: 'Test',
|
7339
|
-
template: EmberHandlebars.compile('<img src="test.jpg" {{bind-attr alt="view.value"}}>')
|
7340
|
-
});
|
7341
|
-
|
7342
|
-
appendView();
|
7343
|
-
|
7344
|
-
equal(view.$('img').attr('alt'), "Test", "renders initial value");
|
7345
|
-
|
7346
|
-
run(function() {
|
7347
|
-
view.set('value', 'Updated');
|
7348
|
-
});
|
7349
|
-
|
7350
|
-
equal(view.$('img').attr('alt'), "Updated", "updates value");
|
7351
|
-
});
|
7352
|
-
|
7353
|
-
test("should be able to bind to globals with {{bind-attr}} (DEPRECATED)", function() {
|
7354
|
-
TemplateTests.set('value', 'Test');
|
7355
|
-
|
7356
|
-
view = EmberView.create({
|
7357
|
-
template: EmberHandlebars.compile('<img src="test.jpg" {{bind-attr alt="TemplateTests.value"}}>')
|
7358
|
-
});
|
7359
|
-
|
7360
|
-
expectDeprecation(function(){
|
7361
|
-
appendView();
|
7362
|
-
}, /Global lookup of TemplateTests.value from a Handlebars template is deprecated/);
|
7363
|
-
|
7364
|
-
equal(view.$('img').attr('alt'), "Test", "renders initial value");
|
7365
|
-
});
|
7366
|
-
|
7367
|
-
test("should not allow XSS injection via {{bind-attr}}", function() {
|
7368
|
-
view = EmberView.create({
|
7369
|
-
template: EmberHandlebars.compile('<img src="test.jpg" {{bind-attr alt="view.content.value"}}>'),
|
7370
|
-
content: {
|
7371
|
-
value: 'Trololol" onmouseover="alert(\'HAX!\');'
|
7372
|
-
}
|
7373
|
-
});
|
7374
|
-
|
7375
|
-
appendView();
|
7376
|
-
|
7377
|
-
equal(view.$('img').attr('onmouseover'), undefined);
|
7378
|
-
// If the whole string is here, then it means we got properly escaped
|
7379
|
-
equal(view.$('img').attr('alt'), 'Trololol" onmouseover="alert(\'HAX!\');');
|
7380
|
-
});
|
7381
|
-
|
7382
|
-
test("should be able to bind use {{bind-attr}} more than once on an element", function() {
|
7383
|
-
var template = EmberHandlebars.compile('<img {{bind-attr src="view.content.url"}} {{bind-attr alt="view.content.title"}}>');
|
7384
|
-
|
7385
|
-
view = EmberView.create({
|
7386
|
-
template: template,
|
7387
|
-
content: EmberObject.create({
|
7388
|
-
url: "http://www.emberjs.com/assets/images/logo.png",
|
7389
|
-
title: "The SproutCore Logo"
|
7390
|
-
})
|
7391
|
-
});
|
7392
|
-
|
7393
|
-
appendView();
|
7394
|
-
|
7395
|
-
equal(view.$('img').attr('src'), "http://www.emberjs.com/assets/images/logo.png", "sets src attribute");
|
7396
|
-
equal(view.$('img').attr('alt'), "The SproutCore Logo", "sets alt attribute");
|
7397
|
-
|
7398
|
-
run(function() {
|
7399
|
-
set(view, 'content.title', "El logo de Eember");
|
7400
|
-
});
|
7401
|
-
|
7402
|
-
equal(view.$('img').attr('alt'), "El logo de Eember", "updates alt attribute when content's title attribute changes");
|
7403
|
-
|
7404
|
-
run(function() {
|
7405
|
-
set(view, 'content', EmberObject.create({
|
7406
|
-
url: "http://www.thegooglez.com/theydonnothing",
|
7407
|
-
title: "I CAN HAZ SEARCH"
|
7408
|
-
}));
|
7409
|
-
});
|
7410
|
-
|
7411
|
-
equal(view.$('img').attr('alt'), "I CAN HAZ SEARCH", "updates alt attribute when content object changes");
|
7412
|
-
|
7413
|
-
run(function() {
|
7414
|
-
set(view, 'content', {
|
7415
|
-
url: "http://www.emberjs.com/assets/images/logo.png",
|
7416
|
-
title: "The SproutCore Logo"
|
7417
|
-
});
|
7418
|
-
});
|
7419
|
-
|
7420
|
-
equal(view.$('img').attr('alt'), "The SproutCore Logo", "updates alt attribute when content object is a hash");
|
7421
|
-
|
7422
|
-
run(function() {
|
7423
|
-
set(view, 'content', EmberObject.createWithMixins({
|
7424
|
-
url: "http://www.emberjs.com/assets/images/logo.png",
|
7425
|
-
title: computed(function() {
|
7426
|
-
return "Nanananana Ember!";
|
7427
|
-
})
|
7428
|
-
}));
|
7429
|
-
});
|
7430
|
-
|
7431
|
-
equal(view.$('img').attr('alt'), "Nanananana Ember!", "updates alt attribute when title property is computed");
|
7432
|
-
|
7433
|
-
});
|
7434
|
-
|
7435
|
-
test("{{bindAttr}} is aliased to {{bind-attr}}", function() {
|
7436
|
-
expect(4);
|
7437
|
-
|
7438
|
-
var originalBindAttr = EmberHandlebars.helpers['bind-attr'];
|
7439
|
-
|
7440
|
-
try {
|
7441
|
-
EmberHandlebars.helpers['bind-attr'] = function() {
|
7442
|
-
equal(arguments[0], 'foo', 'First arg match');
|
7443
|
-
equal(arguments[1], 'bar', 'Second arg match');
|
7444
|
-
|
7445
|
-
return 'result';
|
7446
|
-
};
|
7447
|
-
|
7448
|
-
expectDeprecation(function() {
|
7449
|
-
var result = EmberHandlebars.helpers.bindAttr('foo', 'bar');
|
7450
|
-
equal(result, 'result', 'Result match');
|
7451
|
-
}, "The 'bindAttr' view helper is deprecated in favor of 'bind-attr'");
|
7452
|
-
} finally {
|
7453
|
-
EmberHandlebars.helpers['bind-attr'] = originalBindAttr;
|
7454
|
-
}
|
7455
|
-
});
|
7456
|
-
|
7457
8342
|
test("should not reset cursor position when text field receives keyUp event", function() {
|
7458
8343
|
view = TextField.create({
|
7459
8344
|
value: "Broseidon, King of the Brocean"
|
@@ -7477,224 +8362,6 @@ enifed("ember-handlebars/tests/handlebars_test",
|
|
7477
8362
|
});
|
7478
8363
|
});
|
7479
8364
|
|
7480
|
-
test("should be able to bind element attributes using {{bind-attr}} inside a block", function() {
|
7481
|
-
var template = EmberHandlebars.compile('{{#with view.content}}<img {{bind-attr src="url" alt="title"}}>{{/with}}');
|
7482
|
-
|
7483
|
-
view = EmberView.create({
|
7484
|
-
template: template,
|
7485
|
-
content: EmberObject.create({
|
7486
|
-
url: "http://www.emberjs.com/assets/images/logo.png",
|
7487
|
-
title: "The SproutCore Logo"
|
7488
|
-
})
|
7489
|
-
});
|
7490
|
-
|
7491
|
-
appendView();
|
7492
|
-
|
7493
|
-
equal(view.$('img').attr('src'), "http://www.emberjs.com/assets/images/logo.png", "sets src attribute");
|
7494
|
-
equal(view.$('img').attr('alt'), "The SproutCore Logo", "sets alt attribute");
|
7495
|
-
|
7496
|
-
run(function() {
|
7497
|
-
set(view, 'content.title', "El logo de Eember");
|
7498
|
-
});
|
7499
|
-
|
7500
|
-
equal(view.$('img').attr('alt'), "El logo de Eember", "updates alt attribute when content's title attribute changes");
|
7501
|
-
});
|
7502
|
-
|
7503
|
-
test("should be able to bind class attribute with {{bind-attr}}", function() {
|
7504
|
-
var template = EmberHandlebars.compile('<img {{bind-attr class="view.foo"}}>');
|
7505
|
-
|
7506
|
-
view = EmberView.create({
|
7507
|
-
template: template,
|
7508
|
-
foo: 'bar'
|
7509
|
-
});
|
7510
|
-
|
7511
|
-
appendView();
|
7512
|
-
|
7513
|
-
equal(view.$('img').attr('class'), 'bar', "renders class");
|
7514
|
-
|
7515
|
-
run(function() {
|
7516
|
-
set(view, 'foo', 'baz');
|
7517
|
-
});
|
7518
|
-
|
7519
|
-
equal(view.$('img').attr('class'), 'baz', "updates class");
|
7520
|
-
});
|
7521
|
-
|
7522
|
-
test("should be able to bind class attribute via a truthy property with {{bind-attr}}", function() {
|
7523
|
-
var template = EmberHandlebars.compile('<img {{bind-attr class="view.isNumber:is-truthy"}}>');
|
7524
|
-
|
7525
|
-
view = EmberView.create({
|
7526
|
-
template: template,
|
7527
|
-
isNumber: 5
|
7528
|
-
});
|
7529
|
-
|
7530
|
-
appendView();
|
7531
|
-
|
7532
|
-
equal(view.$('.is-truthy').length, 1, "sets class name");
|
7533
|
-
|
7534
|
-
run(function() {
|
7535
|
-
set(view, 'isNumber', 0);
|
7536
|
-
});
|
7537
|
-
|
7538
|
-
equal(view.$('.is-truthy').length, 0, "removes class name if bound property is set to something non-truthy");
|
7539
|
-
});
|
7540
|
-
|
7541
|
-
test("should be able to bind class to view attribute with {{bind-attr}}", function() {
|
7542
|
-
var template = EmberHandlebars.compile('<img {{bind-attr class="view.foo"}}>');
|
7543
|
-
|
7544
|
-
view = EmberView.create({
|
7545
|
-
template: template,
|
7546
|
-
foo: 'bar'
|
7547
|
-
});
|
7548
|
-
|
7549
|
-
appendView();
|
7550
|
-
|
7551
|
-
equal(view.$('img').attr('class'), 'bar', "renders class");
|
7552
|
-
|
7553
|
-
run(function() {
|
7554
|
-
set(view, 'foo', 'baz');
|
7555
|
-
});
|
7556
|
-
|
7557
|
-
equal(view.$('img').attr('class'), 'baz', "updates class");
|
7558
|
-
});
|
7559
|
-
|
7560
|
-
test("should not allow XSS injection via {{bind-attr}} with class", function() {
|
7561
|
-
view = EmberView.create({
|
7562
|
-
template: EmberHandlebars.compile('<img {{bind-attr class="view.foo"}}>'),
|
7563
|
-
foo: '" onmouseover="alert(\'I am in your classes hacking your app\');'
|
7564
|
-
});
|
7565
|
-
|
7566
|
-
appendView();
|
7567
|
-
|
7568
|
-
equal(view.$('img').attr('onmouseover'), undefined);
|
7569
|
-
// If the whole string is here, then it means we got properly escaped
|
7570
|
-
equal(view.$('img').attr('class'), '" onmouseover="alert(\'I am in your classes hacking your app\');');
|
7571
|
-
});
|
7572
|
-
|
7573
|
-
test("should be able to bind class attribute using ternary operator in {{bind-attr}}", function() {
|
7574
|
-
var template = EmberHandlebars.compile('<img {{bind-attr class="view.content.isDisabled:disabled:enabled"}} />');
|
7575
|
-
var content = EmberObject.create({
|
7576
|
-
isDisabled: true
|
7577
|
-
});
|
7578
|
-
|
7579
|
-
view = EmberView.create({
|
7580
|
-
template: template,
|
7581
|
-
content: content
|
7582
|
-
});
|
7583
|
-
|
7584
|
-
appendView();
|
7585
|
-
|
7586
|
-
ok(view.$('img').hasClass('disabled'), 'disabled class is rendered');
|
7587
|
-
ok(!view.$('img').hasClass('enabled'), 'enabled class is not rendered');
|
7588
|
-
|
7589
|
-
run(function() {
|
7590
|
-
set(content, 'isDisabled', false);
|
7591
|
-
});
|
7592
|
-
|
7593
|
-
ok(!view.$('img').hasClass('disabled'), 'disabled class is not rendered');
|
7594
|
-
ok(view.$('img').hasClass('enabled'), 'enabled class is rendered');
|
7595
|
-
});
|
7596
|
-
|
7597
|
-
test("should be able to add multiple classes using {{bind-attr class}}", function() {
|
7598
|
-
var template = EmberHandlebars.compile('<div {{bind-attr class="view.content.isAwesomeSauce view.content.isAlsoCool view.content.isAmazing:amazing :is-super-duper view.content.isEnabled:enabled:disabled"}}></div>');
|
7599
|
-
var content = EmberObject.create({
|
7600
|
-
isAwesomeSauce: true,
|
7601
|
-
isAlsoCool: true,
|
7602
|
-
isAmazing: true,
|
7603
|
-
isEnabled: true
|
7604
|
-
});
|
7605
|
-
|
7606
|
-
view = EmberView.create({
|
7607
|
-
template: template,
|
7608
|
-
content: content
|
7609
|
-
});
|
7610
|
-
|
7611
|
-
appendView();
|
7612
|
-
|
7613
|
-
ok(view.$('div').hasClass('is-awesome-sauce'), "dasherizes first property and sets classname");
|
7614
|
-
ok(view.$('div').hasClass('is-also-cool'), "dasherizes second property and sets classname");
|
7615
|
-
ok(view.$('div').hasClass('amazing'), "uses alias for third property and sets classname");
|
7616
|
-
ok(view.$('div').hasClass('is-super-duper'), "static class is present");
|
7617
|
-
ok(view.$('div').hasClass('enabled'), "truthy class in ternary classname definition is rendered");
|
7618
|
-
ok(!view.$('div').hasClass('disabled'), "falsy class in ternary classname definition is not rendered");
|
7619
|
-
|
7620
|
-
run(function() {
|
7621
|
-
set(content, 'isAwesomeSauce', false);
|
7622
|
-
set(content, 'isAmazing', false);
|
7623
|
-
set(content, 'isEnabled', false);
|
7624
|
-
});
|
7625
|
-
|
7626
|
-
ok(!view.$('div').hasClass('is-awesome-sauce'), "removes dasherized class when property is set to false");
|
7627
|
-
ok(!view.$('div').hasClass('amazing'), "removes aliased class when property is set to false");
|
7628
|
-
ok(view.$('div').hasClass('is-super-duper'), "static class is still present");
|
7629
|
-
ok(!view.$('div').hasClass('enabled'), "truthy class in ternary classname definition is not rendered");
|
7630
|
-
ok(view.$('div').hasClass('disabled'), "falsy class in ternary classname definition is rendered");
|
7631
|
-
});
|
7632
|
-
|
7633
|
-
test("should be able to bind classes to globals with {{bind-attr class}} (DEPRECATED)", function() {
|
7634
|
-
TemplateTests.set('isOpen', true);
|
7635
|
-
|
7636
|
-
view = EmberView.create({
|
7637
|
-
template: EmberHandlebars.compile('<img src="test.jpg" {{bind-attr class="TemplateTests.isOpen"}}>')
|
7638
|
-
});
|
7639
|
-
|
7640
|
-
expectDeprecation(function(){
|
7641
|
-
appendView();
|
7642
|
-
}, /Global lookup of TemplateTests.isOpen from a Handlebars template is deprecated/);
|
7643
|
-
|
7644
|
-
ok(view.$('img').hasClass('is-open'), "sets classname to the dasherized value of the global property");
|
7645
|
-
});
|
7646
|
-
|
7647
|
-
test("should be able to bind-attr to 'this' in an {{#each}} block", function() {
|
7648
|
-
view = EmberView.create({
|
7649
|
-
template: EmberHandlebars.compile('{{#each view.images}}<img {{bind-attr src="this"}}>{{/each}}'),
|
7650
|
-
images: A(['one.png', 'two.jpg', 'three.gif'])
|
7651
|
-
});
|
7652
|
-
|
7653
|
-
appendView();
|
7654
|
-
|
7655
|
-
var images = view.$('img');
|
7656
|
-
ok(/one\.png$/.test(images[0].src));
|
7657
|
-
ok(/two\.jpg$/.test(images[1].src));
|
7658
|
-
ok(/three\.gif$/.test(images[2].src));
|
7659
|
-
});
|
7660
|
-
|
7661
|
-
test("should be able to bind classes to 'this' in an {{#each}} block with {{bind-attr class}}", function() {
|
7662
|
-
view = EmberView.create({
|
7663
|
-
template: EmberHandlebars.compile('{{#each view.items}}<li {{bind-attr class="this"}}>Item</li>{{/each}}'),
|
7664
|
-
items: A(['a', 'b', 'c'])
|
7665
|
-
});
|
7666
|
-
|
7667
|
-
appendView();
|
7668
|
-
|
7669
|
-
ok(view.$('li').eq(0).hasClass('a'), "sets classname to the value of the first item");
|
7670
|
-
ok(view.$('li').eq(1).hasClass('b'), "sets classname to the value of the second item");
|
7671
|
-
ok(view.$('li').eq(2).hasClass('c'), "sets classname to the value of the third item");
|
7672
|
-
});
|
7673
|
-
|
7674
|
-
test("should be able to bind-attr to var in {{#each var in list}} block", function() {
|
7675
|
-
view = EmberView.create({
|
7676
|
-
template: EmberHandlebars.compile('{{#each image in view.images}}<img {{bind-attr src="image"}}>{{/each}}'),
|
7677
|
-
images: A(['one.png', 'two.jpg', 'three.gif'])
|
7678
|
-
});
|
7679
|
-
|
7680
|
-
appendView();
|
7681
|
-
|
7682
|
-
var images = view.$('img');
|
7683
|
-
ok(/one\.png$/.test(images[0].src));
|
7684
|
-
ok(/two\.jpg$/.test(images[1].src));
|
7685
|
-
ok(/three\.gif$/.test(images[2].src));
|
7686
|
-
|
7687
|
-
run(function() {
|
7688
|
-
var imagesArray = view.get('images');
|
7689
|
-
imagesArray.removeAt(0);
|
7690
|
-
});
|
7691
|
-
|
7692
|
-
images = view.$('img');
|
7693
|
-
ok(images.length === 2, "");
|
7694
|
-
ok(/two\.jpg$/.test(images[0].src));
|
7695
|
-
ok(/three\.gif$/.test(images[1].src));
|
7696
|
-
});
|
7697
|
-
|
7698
8365
|
test("should be able to output a property without binding", function() {
|
7699
8366
|
var context = {
|
7700
8367
|
content: EmberObject.create({
|
@@ -7740,7 +8407,7 @@ enifed("ember-handlebars/tests/handlebars_test",
|
|
7740
8407
|
view = EmberView.create({
|
7741
8408
|
items: A(['a', 'b', 'c', 1, 2, 3]),
|
7742
8409
|
template: EmberHandlebars.compile(
|
7743
|
-
"<ul>{{#each view.items}}<li>{{unbound
|
8410
|
+
"<ul>{{#each item in view.items}}<li>{{unbound item}}</li>{{/each}}</ul>")
|
7744
8411
|
});
|
7745
8412
|
|
7746
8413
|
appendView();
|
@@ -7753,7 +8420,7 @@ enifed("ember-handlebars/tests/handlebars_test",
|
|
7753
8420
|
view = EmberView.create({
|
7754
8421
|
items: A([{wham: 'bam'}, {wham: 1}]),
|
7755
8422
|
template: EmberHandlebars.compile(
|
7756
|
-
"<ul>{{#each view.items}}<li>{{unbound wham}}</li>{{/each}}</ul>")
|
8423
|
+
"<ul>{{#each item in view.items}}<li>{{unbound item.wham}}</li>{{/each}}</ul>")
|
7757
8424
|
});
|
7758
8425
|
|
7759
8426
|
appendView();
|
@@ -7867,7 +8534,7 @@ enifed("ember-handlebars/tests/handlebars_test",
|
|
7867
8534
|
equal(trim(viewInstanceToBeInserted.$().text()), "bar", "renders value from parent's controller");
|
7868
8535
|
});
|
7869
8536
|
|
7870
|
-
test("should expose a view keyword", function() {
|
8537
|
+
test("should expose a view keyword [DEPRECATED]", function() {
|
7871
8538
|
var templateString = '{{#with view.differentContent}}{{view.foo}}{{#view baz="bang"}}{{view.baz}}{{/view}}{{/with}}';
|
7872
8539
|
view = EmberView.create({
|
7873
8540
|
container: container,
|
@@ -7883,7 +8550,9 @@ enifed("ember-handlebars/tests/handlebars_test",
|
|
7883
8550
|
template: EmberHandlebars.compile(templateString)
|
7884
8551
|
});
|
7885
8552
|
|
7886
|
-
|
8553
|
+
expectDeprecation(function() {
|
8554
|
+
appendView();
|
8555
|
+
}, 'Using the context switching form of `{{with}}` is deprecated. Please use the keyword form (`{{with foo as bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
7887
8556
|
|
7888
8557
|
equal(view.$().text(), "barbang", "renders values from view and child view");
|
7889
8558
|
});
|
@@ -7910,30 +8579,33 @@ enifed("ember-handlebars/tests/handlebars_test",
|
|
7910
8579
|
|
7911
8580
|
test("should escape HTML in primitive value contexts when using normal mustaches", function() {
|
7912
8581
|
view = EmberView.create({
|
7913
|
-
|
7914
|
-
|
8582
|
+
context: '<b>Max</b><b>James</b>',
|
8583
|
+
template: EmberHandlebars.compile('{{this}}'),
|
7915
8584
|
});
|
7916
8585
|
|
7917
8586
|
appendView();
|
8587
|
+
|
7918
8588
|
equal(view.$('b').length, 0, "does not create an element");
|
7919
8589
|
equal(view.$().text(), '<b>Max</b><b>James</b>', "inserts entities, not elements");
|
7920
8590
|
|
7921
|
-
run(function() { set(view, '
|
8591
|
+
run(function() { set(view, 'context', '<i>Max</i><i>James</i>'); });
|
8592
|
+
|
7922
8593
|
equal(view.$().text(), '<i>Max</i><i>James</i>', "updates with entities, not elements");
|
7923
8594
|
equal(view.$('i').length, 0, "does not create an element when value is updated");
|
7924
8595
|
});
|
7925
8596
|
|
7926
8597
|
test("should not escape HTML in primitive value contexts when using triple mustaches", function() {
|
7927
8598
|
view = EmberView.create({
|
7928
|
-
|
7929
|
-
|
8599
|
+
context: '<b>Max</b><b>James</b>',
|
8600
|
+
template: EmberHandlebars.compile('{{{this}}}'),
|
7930
8601
|
});
|
7931
8602
|
|
7932
8603
|
appendView();
|
7933
8604
|
|
7934
8605
|
equal(view.$('b').length, 2, "creates an element");
|
7935
8606
|
|
7936
|
-
run(function() { set(view, '
|
8607
|
+
run(function() { set(view, 'context', '<i>Max</i><i>James</i>'); });
|
8608
|
+
|
7937
8609
|
equal(view.$('i').length, 2, "creates an element when value is updated");
|
7938
8610
|
});
|
7939
8611
|
|
@@ -7989,15 +8661,14 @@ enifed("ember-handlebars/tests/handlebars_test",
|
|
7989
8661
|
|
7990
8662
|
test("should be able to log `this`", function() {
|
7991
8663
|
view = EmberView.create({
|
7992
|
-
|
7993
|
-
|
8664
|
+
context: 'one',
|
8665
|
+
template: EmberHandlebars.compile('{{log this}}'),
|
7994
8666
|
});
|
7995
8667
|
|
7996
8668
|
appendView();
|
7997
8669
|
|
7998
8670
|
equal(view.$().text(), "", "shouldn't render any text");
|
7999
8671
|
equal(logCalls[0], 'one', "should call log with item one");
|
8000
|
-
equal(logCalls[1], 'two', "should call log with item two");
|
8001
8672
|
});
|
8002
8673
|
|
8003
8674
|
var MyApp;
|
@@ -8105,9 +8776,9 @@ enifed("ember-handlebars/tests/handlebars_test",
|
|
8105
8776
|
|
8106
8777
|
test("the {{this}} helper should not fail on removal", function() {
|
8107
8778
|
view = EmberView.create({
|
8108
|
-
|
8109
|
-
|
8110
|
-
|
8779
|
+
context: 'abc',
|
8780
|
+
template: EmberHandlebars.compile('{{#if view.show}}{{this}}{{/if}}'),
|
8781
|
+
show: true
|
8111
8782
|
});
|
8112
8783
|
|
8113
8784
|
appendView();
|
@@ -8166,7 +8837,7 @@ enifed("ember-handlebars/tests/handlebars_test",
|
|
8166
8837
|
equal(trim(view.$().text()), "Name: SFMoMA Price: $20", "should print baz twice");
|
8167
8838
|
});
|
8168
8839
|
|
8169
|
-
test("bindings can be 'this', in which case they *are* the current context", function() {
|
8840
|
+
test("bindings can be 'this', in which case they *are* the current context [DEPRECATED]", function() {
|
8170
8841
|
view = EmberView.create({
|
8171
8842
|
museumOpen: true,
|
8172
8843
|
|
@@ -8179,10 +8850,12 @@ enifed("ember-handlebars/tests/handlebars_test",
|
|
8179
8850
|
}),
|
8180
8851
|
|
8181
8852
|
|
8182
|
-
template: EmberHandlebars.compile('{{#if view.museumOpen}} {{#with view.museumDetails}}{{view museumView
|
8853
|
+
template: EmberHandlebars.compile('{{#if view.museumOpen}} {{#with view.museumDetails}}{{view museumView museum=this}} {{/with}}{{/if}}')
|
8183
8854
|
});
|
8184
8855
|
|
8185
|
-
|
8856
|
+
expectDeprecation(function() {
|
8857
|
+
appendView();
|
8858
|
+
}, 'Using the context switching form of `{{with}}` is deprecated. Please use the keyword form (`{{with foo as bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
8186
8859
|
|
8187
8860
|
equal(trim(view.$().text()), "Name: SFMoMA Price: $20", "should print baz twice");
|
8188
8861
|
});
|
@@ -8382,23 +9055,6 @@ enifed("ember-handlebars/tests/handlebars_test",
|
|
8382
9055
|
equal(observersFor(view, 'foo').length, 1);
|
8383
9056
|
});
|
8384
9057
|
|
8385
|
-
test("should teardown observers from bind-attr on rerender", function() {
|
8386
|
-
view = EmberView.create({
|
8387
|
-
template: EmberHandlebars.compile('<span {{bind-attr class="view.foo" name="view.foo"}}>wat</span>'),
|
8388
|
-
foo: 'bar'
|
8389
|
-
});
|
8390
|
-
|
8391
|
-
appendView();
|
8392
|
-
|
8393
|
-
equal(observersFor(view, 'foo').length, 1);
|
8394
|
-
|
8395
|
-
run(function() {
|
8396
|
-
view.rerender();
|
8397
|
-
});
|
8398
|
-
|
8399
|
-
equal(observersFor(view, 'foo').length, 1);
|
8400
|
-
});
|
8401
|
-
|
8402
9058
|
test("should provide a helpful assertion for bindings within HTML comments", function() {
|
8403
9059
|
view = EmberView.create({
|
8404
9060
|
template: EmberHandlebars.compile('<!-- {{view.someThing}} -->'),
|
@@ -8538,7 +9194,10 @@ enifed("ember-handlebars/tests/helpers/bound_helper_test",
|
|
8538
9194
|
}
|
8539
9195
|
});
|
8540
9196
|
|
8541
|
-
test("primitives should work correctly", function() {
|
9197
|
+
test("primitives should work correctly [DEPRECATED]", function() {
|
9198
|
+
expectDeprecation('Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each foo in bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
9199
|
+
expectDeprecation('Using the context switching form of `{{with}}` is deprecated. Please use the keyword form (`{{with foo as bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
9200
|
+
|
8542
9201
|
view = EmberView.create({
|
8543
9202
|
prims: Ember.A(["string", 12]),
|
8544
9203
|
|
@@ -8881,7 +9540,7 @@ enifed("ember-handlebars/tests/helpers/bound_helper_test",
|
|
8881
9540
|
equal(helperCount, 5, "changing controller property with same name as quoted string doesn't re-render helper");
|
8882
9541
|
});
|
8883
9542
|
|
8884
|
-
test("bound helpers can handle nulls in array (with primitives)", function() {
|
9543
|
+
test("bound helpers can handle nulls in array (with primitives) [DEPRECATED]", function() {
|
8885
9544
|
EmberHandlebars.helper('reverse', function(val) {
|
8886
9545
|
return val ? val.split('').reverse().join('') : "NOPE";
|
8887
9546
|
});
|
@@ -8893,7 +9552,9 @@ enifed("ember-handlebars/tests/helpers/bound_helper_test",
|
|
8893
9552
|
template: compile("{{#each things}}{{this}}|{{reverse this}} {{/each}}{{#each thing in things}}{{thing}}|{{reverse thing}} {{/each}}")
|
8894
9553
|
});
|
8895
9554
|
|
8896
|
-
|
9555
|
+
expectDeprecation(function() {
|
9556
|
+
appendView();
|
9557
|
+
}, 'Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each foo in bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
8897
9558
|
|
8898
9559
|
equal(view.$().text(), '|NOPE 0|NOPE |NOPE false|NOPE OMG|GMO |NOPE 0|NOPE |NOPE false|NOPE OMG|GMO ', "helper output is correct");
|
8899
9560
|
|
@@ -8917,7 +9578,9 @@ enifed("ember-handlebars/tests/helpers/bound_helper_test",
|
|
8917
9578
|
template: compile("{{#each things}}{{foo}}|{{print-foo this}} {{/each}}{{#each thing in things}}{{thing.foo}}|{{print-foo thing}} {{/each}}")
|
8918
9579
|
});
|
8919
9580
|
|
8920
|
-
|
9581
|
+
expectDeprecation(function() {
|
9582
|
+
appendView();
|
9583
|
+
}, 'Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each foo in bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
8921
9584
|
|
8922
9585
|
equal(view.$().text(), '|NOPE 5|5 |NOPE 5|5 ', "helper output is correct");
|
8923
9586
|
|
@@ -8933,20 +9596,24 @@ enifed("ember-handlebars/tests/helpers/bound_helper_test",
|
|
8933
9596
|
});
|
8934
9597
|
|
8935
9598
|
view = EmberView.create({
|
8936
|
-
|
8937
|
-
|
8938
|
-
}),
|
8939
|
-
template: compile("{{#each things}}{{shout this}}{{/each}}")
|
9599
|
+
context: 'alex',
|
9600
|
+
template: compile("{{shout this}}")
|
8940
9601
|
});
|
8941
9602
|
|
8942
9603
|
appendView();
|
8943
9604
|
|
8944
9605
|
equal(view.$().text(), 'alex!', "helper output is correct");
|
8945
9606
|
|
8946
|
-
run(
|
8947
|
-
|
9607
|
+
run(function() {
|
9608
|
+
set(view, 'context', '');
|
9609
|
+
});
|
9610
|
+
|
9611
|
+
equal(view.$().text(), '!', "helper output is correct");
|
9612
|
+
|
9613
|
+
run(function() {
|
9614
|
+
set(view, 'context', 'wallace');
|
9615
|
+
});
|
8948
9616
|
|
8949
|
-
run(view.controller.things, 'pushObject', 'wallace');
|
8950
9617
|
equal(view.$().text(), 'wallace!', "helper output is correct");
|
8951
9618
|
});
|
8952
9619
|
|
@@ -9192,7 +9859,7 @@ enifed("ember-handlebars/tests/helpers/each_test",
|
|
9192
9859
|
var originalLookup = Ember.lookup;
|
9193
9860
|
var lookup;
|
9194
9861
|
|
9195
|
-
QUnit.module("the #each helper", {
|
9862
|
+
QUnit.module("the #each helper [DEPRECATED]", {
|
9196
9863
|
setup: function() {
|
9197
9864
|
Ember.lookup = lookup = { Ember: Ember };
|
9198
9865
|
|
@@ -9214,7 +9881,9 @@ enifed("ember-handlebars/tests/helpers/each_test",
|
|
9214
9881
|
template: templateMyView
|
9215
9882
|
});
|
9216
9883
|
|
9217
|
-
|
9884
|
+
expectDeprecation(function() {
|
9885
|
+
append(view);
|
9886
|
+
},'Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each foo in bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
9218
9887
|
},
|
9219
9888
|
|
9220
9889
|
teardown: function() {
|
@@ -9718,6 +10387,8 @@ enifed("ember-handlebars/tests/helpers/each_test",
|
|
9718
10387
|
});
|
9719
10388
|
|
9720
10389
|
test("it works with the controller keyword", function() {
|
10390
|
+
run(view, 'destroy'); // destroy existing view
|
10391
|
+
|
9721
10392
|
var controller = ArrayController.create({
|
9722
10393
|
model: A(["foo", "bar", "baz"])
|
9723
10394
|
});
|
@@ -9734,6 +10405,55 @@ enifed("ember-handlebars/tests/helpers/each_test",
|
|
9734
10405
|
equal(view.$().text(), "foobarbaz");
|
9735
10406
|
});
|
9736
10407
|
|
10408
|
+
test("views inside #each preserve the new context [DEPRECATED]", function() {
|
10409
|
+
run(view, 'destroy'); // destroy existing view
|
10410
|
+
|
10411
|
+
var controller = A([ { name: "Adam" }, { name: "Steve" } ]);
|
10412
|
+
|
10413
|
+
view = EmberView.create({
|
10414
|
+
container: container,
|
10415
|
+
controller: controller,
|
10416
|
+
template: templateFor('{{#each controller}}{{#view}}{{name}}{{/view}}{{/each}}')
|
10417
|
+
});
|
10418
|
+
|
10419
|
+
|
10420
|
+
expectDeprecation(function() {
|
10421
|
+
append(view);
|
10422
|
+
},'Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each foo in bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
10423
|
+
|
10424
|
+
equal(view.$().text(), "AdamSteve");
|
10425
|
+
});
|
10426
|
+
|
10427
|
+
test("single-arg each defaults to current context [DEPRECATED]", function() {
|
10428
|
+
run(view, 'destroy'); // destroy existing view
|
10429
|
+
|
10430
|
+
view = EmberView.create({
|
10431
|
+
context: A([ { name: "Adam" }, { name: "Steve" } ]),
|
10432
|
+
template: templateFor('{{#each}}{{name}}{{/each}}')
|
10433
|
+
});
|
10434
|
+
|
10435
|
+
expectDeprecation(function() {
|
10436
|
+
append(view);
|
10437
|
+
},'Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each foo in bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
10438
|
+
|
10439
|
+
equal(view.$().text(), "AdamSteve");
|
10440
|
+
});
|
10441
|
+
|
10442
|
+
test("single-arg each will iterate over controller if present [DEPRECATED]", function() {
|
10443
|
+
run(view, 'destroy'); // destroy existing view
|
10444
|
+
|
10445
|
+
view = EmberView.create({
|
10446
|
+
controller: A([ { name: "Adam" }, { name: "Steve" } ]),
|
10447
|
+
template: templateFor('{{#each}}{{name}}{{/each}}')
|
10448
|
+
});
|
10449
|
+
|
10450
|
+
expectDeprecation(function() {
|
10451
|
+
append(view);
|
10452
|
+
},'Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each foo in bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
10453
|
+
|
10454
|
+
equal(view.$().text(), "AdamSteve");
|
10455
|
+
});
|
10456
|
+
|
9737
10457
|
QUnit.module("{{#each foo in bar}}", {
|
9738
10458
|
setup: function() {
|
9739
10459
|
container = new Container();
|
@@ -9810,7 +10530,7 @@ enifed("ember-handlebars/tests/helpers/each_test",
|
|
9810
10530
|
equal(view.$().text(), "My Cool Each Test 1My Cool Each Test 2");
|
9811
10531
|
});
|
9812
10532
|
|
9813
|
-
test("views inside #each preserve the new context", function() {
|
10533
|
+
test("views inside #each preserve the new context [DEPRECATED]", function() {
|
9814
10534
|
var controller = A([ { name: "Adam" }, { name: "Steve" } ]);
|
9815
10535
|
|
9816
10536
|
view = EmberView.create({
|
@@ -9819,7 +10539,9 @@ enifed("ember-handlebars/tests/helpers/each_test",
|
|
9819
10539
|
template: templateFor('{{#each controller}}{{#view}}{{name}}{{/view}}{{/each}}')
|
9820
10540
|
});
|
9821
10541
|
|
9822
|
-
|
10542
|
+
expectDeprecation(function() {
|
10543
|
+
append(view);
|
10544
|
+
},'Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each foo in bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
9823
10545
|
|
9824
10546
|
equal(view.$().text(), "AdamSteve");
|
9825
10547
|
});
|
@@ -9840,32 +10562,10 @@ enifed("ember-handlebars/tests/helpers/each_test",
|
|
9840
10562
|
equal(view.$().text(), "AdamSteve");
|
9841
10563
|
});
|
9842
10564
|
|
9843
|
-
test("single-arg each defaults to current context", function() {
|
9844
|
-
view = EmberView.create({
|
9845
|
-
context: A([ { name: "Adam" }, { name: "Steve" } ]),
|
9846
|
-
template: templateFor('{{#each}}{{name}}{{/each}}')
|
9847
|
-
});
|
9848
|
-
|
9849
|
-
append(view);
|
9850
|
-
|
9851
|
-
equal(view.$().text(), "AdamSteve");
|
9852
|
-
});
|
9853
|
-
|
9854
|
-
test("single-arg each will iterate over controller if present", function() {
|
9855
|
-
view = EmberView.create({
|
9856
|
-
controller: A([ { name: "Adam" }, { name: "Steve" } ]),
|
9857
|
-
template: templateFor('{{#each}}{{name}}{{/each}}')
|
9858
|
-
});
|
9859
|
-
|
9860
|
-
append(view);
|
9861
|
-
|
9862
|
-
equal(view.$().text(), "AdamSteve");
|
9863
|
-
});
|
9864
|
-
|
9865
10565
|
test("it doesn't assert when the morph tags have the same parent", function() {
|
9866
10566
|
view = EmberView.create({
|
9867
10567
|
controller: A(['Cyril', 'David']),
|
9868
|
-
template: templateFor('<table><tbody>{{#each}}<tr><td>{{
|
10568
|
+
template: templateFor('<table><tbody>{{#each name in this}}<tr><td>{{name}}</td></tr>{{/each}}<tbody></table>')
|
9869
10569
|
});
|
9870
10570
|
|
9871
10571
|
append(view);
|
@@ -9949,6 +10649,36 @@ enifed("ember-handlebars/tests/helpers/each_test",
|
|
9949
10649
|
|
9950
10650
|
equal(view.$().text(), "controller:people - controller:Steve Holt of Yapp - controller:people - controller:Annabelle of Yapp - ");
|
9951
10651
|
});
|
10652
|
+
|
10653
|
+
test("{{each}} without arguments [DEPRECATED]", function() {
|
10654
|
+
expect(2);
|
10655
|
+
|
10656
|
+
view = EmberView.create({
|
10657
|
+
controller: A([ { name: "Adam" }, { name: "Steve" } ]),
|
10658
|
+
template: templateFor('{{#each}}{{name}}{{/each}}')
|
10659
|
+
});
|
10660
|
+
|
10661
|
+
expectDeprecation(function() {
|
10662
|
+
append(view);
|
10663
|
+
},'Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each foo in bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
10664
|
+
|
10665
|
+
equal(view.$().text(), "AdamSteve");
|
10666
|
+
});
|
10667
|
+
|
10668
|
+
test("{{each this}} without keyword [DEPRECATED]", function() {
|
10669
|
+
expect(2);
|
10670
|
+
|
10671
|
+
view = EmberView.create({
|
10672
|
+
controller: A([ { name: "Adam" }, { name: "Steve" } ]),
|
10673
|
+
template: templateFor('{{#each this}}{{name}}{{/each}}')
|
10674
|
+
});
|
10675
|
+
|
10676
|
+
expectDeprecation(function() {
|
10677
|
+
append(view);
|
10678
|
+
},'Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each foo in bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
10679
|
+
|
10680
|
+
equal(view.$().text(), "AdamSteve");
|
10681
|
+
});
|
9952
10682
|
});
|
9953
10683
|
enifed("ember-handlebars/tests/helpers/each_test.jshint",
|
9954
10684
|
[],
|
@@ -10094,7 +10824,7 @@ enifed("ember-handlebars/tests/helpers/group_test",
|
|
10094
10824
|
test("#each with no content", function() {
|
10095
10825
|
expect(0);
|
10096
10826
|
createGroupedView(
|
10097
|
-
"{{#each missing}}{{
|
10827
|
+
"{{#each item in missing}}{{item}}{{/each}}"
|
10098
10828
|
);
|
10099
10829
|
appendView();
|
10100
10830
|
});
|
@@ -10103,7 +10833,7 @@ enifed("ember-handlebars/tests/helpers/group_test",
|
|
10103
10833
|
expect(0);
|
10104
10834
|
|
10105
10835
|
createGroupedView(
|
10106
|
-
"{{#each numbers}}{{
|
10836
|
+
"{{#each number in numbers}}{{number}}{{/each}}",
|
10107
10837
|
{numbers: A([1,2,3])}
|
10108
10838
|
);
|
10109
10839
|
appendView();
|
@@ -10116,7 +10846,7 @@ enifed("ember-handlebars/tests/helpers/group_test",
|
|
10116
10846
|
|
10117
10847
|
test("#each can be nested", function() {
|
10118
10848
|
createGroupedView(
|
10119
|
-
"{{#each numbers}}{{
|
10849
|
+
"{{#each number in numbers}}{{number}}{{/each}}",
|
10120
10850
|
{numbers: A([1, 2, 3])}
|
10121
10851
|
);
|
10122
10852
|
appendView();
|
@@ -10137,7 +10867,7 @@ enifed("ember-handlebars/tests/helpers/group_test",
|
|
10137
10867
|
|
10138
10868
|
test("#each can be used with an ArrayProxy", function() {
|
10139
10869
|
createGroupedView(
|
10140
|
-
"{{#each numbers}}{{
|
10870
|
+
"{{#each number in numbers}}{{number}}{{/each}}",
|
10141
10871
|
{numbers: ArrayProxy.create({content: A([1, 2, 3])})}
|
10142
10872
|
);
|
10143
10873
|
appendView();
|
@@ -10173,7 +10903,7 @@ enifed("ember-handlebars/tests/helpers/group_test",
|
|
10173
10903
|
test("an #each can be nested with a view inside", function() {
|
10174
10904
|
var yehuda = {name: 'Yehuda'};
|
10175
10905
|
createGroupedView(
|
10176
|
-
'{{#each people}}{{#view}}{{name}}{{/view}}{{/each}}',
|
10906
|
+
'{{#each person in people}}{{#view}}{{person.name}}{{/view}}{{/each}}',
|
10177
10907
|
{people: A([yehuda, {name: 'Tom'}])}
|
10178
10908
|
);
|
10179
10909
|
appendView();
|
@@ -10190,7 +10920,7 @@ enifed("ember-handlebars/tests/helpers/group_test",
|
|
10190
10920
|
var yehuda = {name: 'Yehuda'};
|
10191
10921
|
container.register('view:test', Component.extend());
|
10192
10922
|
createGroupedView(
|
10193
|
-
'{{#each people}}{{#view "test"}}{{name}}{{/view}}{{/each}}',
|
10923
|
+
'{{#each person in people}}{{#view "test"}}{{person.name}}{{/view}}{{/each}}',
|
10194
10924
|
{people: A([yehuda, {name: 'Tom'}])}
|
10195
10925
|
);
|
10196
10926
|
|
@@ -10206,7 +10936,7 @@ enifed("ember-handlebars/tests/helpers/group_test",
|
|
10206
10936
|
|
10207
10937
|
test("#each with groupedRows=true behaves like a normal bound #each", function() {
|
10208
10938
|
createGroupedView(
|
10209
|
-
'{{#each numbers groupedRows=true}}{{
|
10939
|
+
'{{#each number in numbers groupedRows=true}}{{number}}{{/each}}',
|
10210
10940
|
{numbers: A([1, 2, 3])}
|
10211
10941
|
);
|
10212
10942
|
appendView();
|
@@ -10222,7 +10952,7 @@ enifed("ember-handlebars/tests/helpers/group_test",
|
|
10222
10952
|
test("#each with itemViewClass behaves like a normal bound #each", function() {
|
10223
10953
|
container.register('view:nothing-special-view', Ember.View);
|
10224
10954
|
createGroupedView(
|
10225
|
-
'{{#each people itemViewClass="nothing-special-view"}}{{name}}{{/each}}',
|
10955
|
+
'{{#each person in people itemViewClass="nothing-special-view"}}{{person.name}}{{/each}}',
|
10226
10956
|
{people: A([{name: 'Erik'}, {name: 'Peter'}])}
|
10227
10957
|
);
|
10228
10958
|
appendView();
|
@@ -10291,14 +11021,16 @@ enifed("ember-handlebars/tests/helpers/if_unless_test",
|
|
10291
11021
|
}
|
10292
11022
|
});
|
10293
11023
|
|
10294
|
-
test("unless should keep the current context (#784)", function() {
|
11024
|
+
test("unless should keep the current context (#784) [DEPRECATED]", function() {
|
10295
11025
|
view = EmberView.create({
|
10296
11026
|
o: EmberObject.create({foo: '42'}),
|
10297
11027
|
|
10298
11028
|
template: compile('{{#with view.o}}{{#view}}{{#unless view.doesNotExist}}foo: {{foo}}{{/unless}}{{/view}}{{/with}}')
|
10299
11029
|
});
|
10300
11030
|
|
10301
|
-
|
11031
|
+
expectDeprecation(function() {
|
11032
|
+
appendView(view);
|
11033
|
+
}, 'Using the context switching form of `{{with}}` is deprecated. Please use the keyword form (`{{with foo as bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
10302
11034
|
|
10303
11035
|
equal(view.$().text(), 'foo: 42');
|
10304
11036
|
});
|
@@ -11537,7 +12269,7 @@ enifed("ember-handlebars/tests/helpers/with_test",
|
|
11537
12269
|
|
11538
12270
|
QUnit.module("Handlebars {{#with foo}} insideGroup");
|
11539
12271
|
|
11540
|
-
test("it should render without fail", function() {
|
12272
|
+
test("it should render without fail [DEPRECATED]", function() {
|
11541
12273
|
var View = EmberView.extend({
|
11542
12274
|
template: EmberHandlebars.compile("{{#view view.childView}}{{#with person}}{{name}}{{/with}}{{/view}}"),
|
11543
12275
|
controller: EmberObject.create({ person: { name: "Ivan IV Vasilyevich" } }),
|
@@ -11550,7 +12282,11 @@ enifed("ember-handlebars/tests/helpers/with_test",
|
|
11550
12282
|
});
|
11551
12283
|
|
11552
12284
|
var view = View.create();
|
11553
|
-
|
12285
|
+
|
12286
|
+
expectDeprecation(function(){
|
12287
|
+
appendView(view);
|
12288
|
+
}, 'Using the context switching form of `{{with}}` is deprecated. Please use the keyword form (`{{with foo as bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
12289
|
+
|
11554
12290
|
equal(view.$().text(), "Ivan IV Vasilyevich", "should be properly scoped");
|
11555
12291
|
|
11556
12292
|
run(function() {
|
@@ -11566,7 +12302,7 @@ enifed("ember-handlebars/tests/helpers/with_test",
|
|
11566
12302
|
|
11567
12303
|
QUnit.module("Handlebars {{#with foo}} with defined controller");
|
11568
12304
|
|
11569
|
-
test("it should wrap context with object controller", function() {
|
12305
|
+
test("it should wrap context with object controller [DEPRECATED]", function() {
|
11570
12306
|
var Controller = ObjectController.extend({
|
11571
12307
|
controllerName: computed(function() {
|
11572
12308
|
return "controller:"+this.get('model.name') + ' and ' + this.get('parentController.name');
|
@@ -11590,7 +12326,9 @@ enifed("ember-handlebars/tests/helpers/with_test",
|
|
11590
12326
|
|
11591
12327
|
container.register('controller:person', Controller);
|
11592
12328
|
|
11593
|
-
|
12329
|
+
expectDeprecation(function(){
|
12330
|
+
appendView(view);
|
12331
|
+
}, 'Using the context switching form of `{{with}}` is deprecated. Please use the keyword form (`{{with foo as bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
11594
12332
|
|
11595
12333
|
equal(view.$().text(), "controller:Steve Holt and Bob Loblaw");
|
11596
12334
|
|
@@ -11619,7 +12357,7 @@ enifed("ember-handlebars/tests/helpers/with_test",
|
|
11619
12357
|
run(function() { view.destroy(); }); // destroy existing view
|
11620
12358
|
});
|
11621
12359
|
|
11622
|
-
test("it should still have access to original parentController within an {{#each}}", function() {
|
12360
|
+
test("it should still have access to original parentController within an {{#each}} [DEPRECATED]", function() {
|
11623
12361
|
var Controller = ObjectController.extend({
|
11624
12362
|
controllerName: computed(function() {
|
11625
12363
|
return "controller:"+this.get('model.name') + ' and ' + this.get('parentController.name');
|
@@ -11643,7 +12381,9 @@ enifed("ember-handlebars/tests/helpers/with_test",
|
|
11643
12381
|
|
11644
12382
|
container.register('controller:person', Controller);
|
11645
12383
|
|
11646
|
-
|
12384
|
+
expectDeprecation(function() {
|
12385
|
+
appendView(view);
|
12386
|
+
}, 'Using the context switching form of `{{with}}` is deprecated. Please use the keyword form (`{{with foo as bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
11647
12387
|
|
11648
12388
|
equal(view.$().text(), "controller:Steve Holt and Bob Loblawcontroller:Carl Weathers and Bob Loblaw");
|
11649
12389
|
|
@@ -11701,7 +12441,7 @@ enifed("ember-handlebars/tests/helpers/with_test",
|
|
11701
12441
|
run(function() { view.destroy(); }); // destroy existing view
|
11702
12442
|
});
|
11703
12443
|
|
11704
|
-
test("destroys the controller generated with {{with foo controller='blah'}}", function() {
|
12444
|
+
test("destroys the controller generated with {{with foo as bar controller='blah'}}", function() {
|
11705
12445
|
var destroyed = false;
|
11706
12446
|
var Controller = ObjectController.extend({
|
11707
12447
|
willDestroy: function() {
|
@@ -11721,7 +12461,7 @@ enifed("ember-handlebars/tests/helpers/with_test",
|
|
11721
12461
|
|
11722
12462
|
view = EmberView.create({
|
11723
12463
|
container: container,
|
11724
|
-
template: EmberHandlebars.compile('{{#with person controller="person"}}{{controllerName}}{{/with}}'),
|
12464
|
+
template: EmberHandlebars.compile('{{#with person as otherPerson controller="person"}}{{controllerName}}{{/with}}'),
|
11725
12465
|
controller: parentController
|
11726
12466
|
});
|
11727
12467
|
|
@@ -11877,7 +12617,7 @@ enifed("ember-handlebars/tests/helpers/yield_test",
|
|
11877
12617
|
|
11878
12618
|
test("templates should yield to block, when the yield is embedded in a hierarchy of virtual views", function() {
|
11879
12619
|
var TimesView = EmberView.extend({
|
11880
|
-
layout: EmberHandlebars.compile('<div class="times">{{#each view.index}}{{yield}}{{/each}}</div>'),
|
12620
|
+
layout: EmberHandlebars.compile('<div class="times">{{#each item in view.index}}{{yield}}{{/each}}</div>'),
|
11881
12621
|
n: null,
|
11882
12622
|
index: computed(function() {
|
11883
12623
|
var n = get(this, 'n');
|
@@ -11953,7 +12693,7 @@ enifed("ember-handlebars/tests/helpers/yield_test",
|
|
11953
12693
|
equal(view.$('div p:contains(inner) + p:contains(outer)').length, 1, "Yield points at the right context");
|
11954
12694
|
});
|
11955
12695
|
|
11956
|
-
test("yield inside a conditional uses the outer context", function() {
|
12696
|
+
test("yield inside a conditional uses the outer context [DEPRECATED]", function() {
|
11957
12697
|
var component = Component.extend({
|
11958
12698
|
boundText: "inner",
|
11959
12699
|
truthy: true,
|
@@ -11966,9 +12706,9 @@ enifed("ember-handlebars/tests/helpers/yield_test",
|
|
11966
12706
|
template: EmberHandlebars.compile('{{#with obj}}{{#if truthy}}{{#view component}}{{#if truthy}}{{boundText}}{{/if}}{{/view}}{{/if}}{{/with}}')
|
11967
12707
|
});
|
11968
12708
|
|
11969
|
-
|
11970
|
-
view
|
11971
|
-
});
|
12709
|
+
expectDeprecation(function() {
|
12710
|
+
run(view, 'appendTo', '#qunit-fixture');
|
12711
|
+
}, 'Using the context switching form of `{{with}}` is deprecated. Please use the keyword form (`{{with foo as bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
11972
12712
|
|
11973
12713
|
equal(view.$('div p:contains(inner) + p:contains(insideWith)').length, 1, "Yield points at the right context");
|
11974
12714
|
});
|
@@ -12033,7 +12773,7 @@ enifed("ember-handlebars/tests/helpers/yield_test",
|
|
12033
12773
|
equal(view.$('div p:contains(update) + p:contains(update)').length, 1, "keyword has correctly propagated update");
|
12034
12774
|
});
|
12035
12775
|
|
12036
|
-
test("yield uses the layout context for non component", function() {
|
12776
|
+
test("yield uses the layout context for non component [DEPRECATED]", function() {
|
12037
12777
|
view = EmberView.create({
|
12038
12778
|
controller: {
|
12039
12779
|
boundText: "outer",
|
@@ -12045,9 +12785,9 @@ enifed("ember-handlebars/tests/helpers/yield_test",
|
|
12045
12785
|
template: EmberHandlebars.compile('{{boundText}}')
|
12046
12786
|
});
|
12047
12787
|
|
12048
|
-
|
12049
|
-
view
|
12050
|
-
});
|
12788
|
+
expectDeprecation(function() {
|
12789
|
+
run(view, 'appendTo', '#qunit-fixture');
|
12790
|
+
}, 'Using the context switching form of `{{with}}` is deprecated. Please use the keyword form (`{{with foo as bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
12051
12791
|
|
12052
12792
|
equal('outerinner', view.$('p').text(), "Yield points at the right context");
|
12053
12793
|
});
|
@@ -12787,7 +13527,7 @@ enifed("ember-handlebars/tests/views/collection_view_test",
|
|
12787
13527
|
equal(view.$('ul li').length, 3, "collection renders when conditional changes to true");
|
12788
13528
|
});
|
12789
13529
|
|
12790
|
-
test("should pass content as context when using {{#each}} helper", function() {
|
13530
|
+
test("should pass content as context when using {{#each}} helper [DEPRECATED]", function() {
|
12791
13531
|
view = EmberView.create({
|
12792
13532
|
template: EmberHandlebars.compile('{{#each view.releases}}Mac OS X {{version}}: {{name}} {{/each}}'),
|
12793
13533
|
|
@@ -12801,7 +13541,9 @@ enifed("ember-handlebars/tests/views/collection_view_test",
|
|
12801
13541
|
])
|
12802
13542
|
});
|
12803
13543
|
|
12804
|
-
|
13544
|
+
expectDeprecation(function() {
|
13545
|
+
run(view, 'appendTo', '#qunit-fixture');
|
13546
|
+
}, 'Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each foo in bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
12805
13547
|
|
12806
13548
|
equal(view.$().text(), "Mac OS X 10.7: Lion Mac OS X 10.6: Snow Leopard Mac OS X 10.5: Leopard ", "prints each item in sequence");
|
12807
13549
|
});
|
@@ -15921,7 +16663,7 @@ enifed("ember-metal/tests/computed_test",
|
|
15921
16663
|
equal(get(obj, 'foo'), 'foo 3', 'cached retrieve');
|
15922
16664
|
});
|
15923
16665
|
|
15924
|
-
testBoth('redefining a property should undo old
|
16666
|
+
testBoth('redefining a property should undo old dependent keys', function(get ,set) {
|
15925
16667
|
|
15926
16668
|
equal(isWatching(obj, 'bar'), false, 'precond not watching dependent key');
|
15927
16669
|
equal(get(obj, 'foo'), 'bar 1');
|
@@ -21366,70 +22108,6 @@ enifed("ember-metal/tests/run_loop/debounce_test.jshint",
|
|
21366
22108
|
ok(true, 'ember-metal/tests/run_loop/debounce_test.js should pass jshint.');
|
21367
22109
|
});
|
21368
22110
|
});
|
21369
|
-
enifed("ember-metal/tests/run_loop/join_test",
|
21370
|
-
["ember-metal/run_loop"],
|
21371
|
-
function(__dependency1__) {
|
21372
|
-
"use strict";
|
21373
|
-
var run = __dependency1__["default"];
|
21374
|
-
|
21375
|
-
QUnit.module('system/run_loop/join_test');
|
21376
|
-
|
21377
|
-
test('run.join brings its own run loop if none provided', function() {
|
21378
|
-
ok(!run.currentRunLoop, 'expects no existing run-loop');
|
21379
|
-
|
21380
|
-
run.join(function() {
|
21381
|
-
ok(run.currentRunLoop, 'brings its own run loop');
|
21382
|
-
});
|
21383
|
-
});
|
21384
|
-
|
21385
|
-
test('run.join joins and existing run-loop, and fires its action queue.', function() {
|
21386
|
-
var outerRunLoop, wasInvoked;
|
21387
|
-
|
21388
|
-
run(function() {
|
21389
|
-
outerRunLoop = run.currentRunLoop;
|
21390
|
-
|
21391
|
-
run.join(function() {
|
21392
|
-
wasInvoked = true;
|
21393
|
-
deepEqual(outerRunLoop, run.currentRunLoop, 'joined the existing run-loop');
|
21394
|
-
});
|
21395
|
-
|
21396
|
-
ok(!wasInvoked, 'expected the joined callback not be invoked yet');
|
21397
|
-
});
|
21398
|
-
ok(wasInvoked, 'expected the joined callback to have invoked');
|
21399
|
-
});
|
21400
|
-
|
21401
|
-
test('run.join returns a value if creating a new run-loop', function() {
|
21402
|
-
var value = 'returned value';
|
21403
|
-
|
21404
|
-
var result = run.join(function() {
|
21405
|
-
return value;
|
21406
|
-
});
|
21407
|
-
|
21408
|
-
equal(value, result, 'returns expected output');
|
21409
|
-
});
|
21410
|
-
|
21411
|
-
test('run.join returns undefined if joining another run-loop', function() {
|
21412
|
-
var value = 'returned value';
|
21413
|
-
var result;
|
21414
|
-
|
21415
|
-
run(function() {
|
21416
|
-
result = run.join(function() {
|
21417
|
-
return value;
|
21418
|
-
});
|
21419
|
-
});
|
21420
|
-
|
21421
|
-
equal(result, undefined, 'returns nothing');
|
21422
|
-
});
|
21423
|
-
});
|
21424
|
-
enifed("ember-metal/tests/run_loop/join_test.jshint",
|
21425
|
-
[],
|
21426
|
-
function() {
|
21427
|
-
"use strict";
|
21428
|
-
module('JSHint - ember-metal/tests/run_loop');
|
21429
|
-
test('ember-metal/tests/run_loop/join_test.js should pass jshint', function() {
|
21430
|
-
ok(true, 'ember-metal/tests/run_loop/join_test.js should pass jshint.');
|
21431
|
-
});
|
21432
|
-
});
|
21433
22111
|
enifed("ember-metal/tests/run_loop/later_test",
|
21434
22112
|
["ember-metal/is_none","ember-metal/run_loop"],
|
21435
22113
|
function(__dependency1__, __dependency2__) {
|
@@ -23714,7 +24392,7 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
23714
24392
|
boundText: "inner",
|
23715
24393
|
truthy: true,
|
23716
24394
|
obj: {},
|
23717
|
-
layout: EmberHandlebars.compile("<div>{{boundText}}</div><div>{{#if truthy}}{{
|
24395
|
+
layout: EmberHandlebars.compile("<div>{{boundText}}</div><div>{{#if truthy}}{{yield}}{{/if}}</div>")
|
23718
24396
|
});
|
23719
24397
|
|
23720
24398
|
view = EmberView.create({
|
@@ -23724,13 +24402,9 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
23724
24402
|
wat: function() {
|
23725
24403
|
watted = true;
|
23726
24404
|
},
|
23727
|
-
|
23728
|
-
component: component,
|
23729
|
-
truthy: true,
|
23730
|
-
boundText: 'insideWith'
|
23731
|
-
}
|
24405
|
+
component: component
|
23732
24406
|
},
|
23733
|
-
template: EmberHandlebars.compile('{{#
|
24407
|
+
template: EmberHandlebars.compile('{{#if truthy}}{{#view component}}{{#if truthy}}<div {{action "wat"}} class="wat">{{boundText}}</div>{{/if}}{{/view}}{{/if}}')
|
23734
24408
|
});
|
23735
24409
|
|
23736
24410
|
appendView();
|
@@ -23742,7 +24416,7 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
23742
24416
|
equal(watted, true, "The action was called on the right context");
|
23743
24417
|
});
|
23744
24418
|
|
23745
|
-
test("should target the current controller inside an {{each}} loop", function() {
|
24419
|
+
test("should target the current controller inside an {{each}} loop [DEPRECATED]", function() {
|
23746
24420
|
var registeredTarget;
|
23747
24421
|
|
23748
24422
|
ActionHelper.registerAction = function(actionName, options) {
|
@@ -23767,14 +24441,16 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
23767
24441
|
template: EmberHandlebars.compile('{{#each controller}}{{action "editTodo"}}{{/each}}')
|
23768
24442
|
});
|
23769
24443
|
|
23770
|
-
|
24444
|
+
expectDeprecation(function() {
|
24445
|
+
appendView();
|
24446
|
+
}, 'Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each foo in bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
23771
24447
|
|
23772
24448
|
equal(registeredTarget, itemController, "the item controller is the target of action");
|
23773
24449
|
|
23774
24450
|
ActionHelper.registerAction = originalRegisterAction;
|
23775
24451
|
});
|
23776
24452
|
|
23777
|
-
test("should target the with-controller inside an {{#with controller='person'}}", function() {
|
24453
|
+
test("should target the with-controller inside an {{#with controller='person'}} [DEPRECATED]", function() {
|
23778
24454
|
var registeredTarget;
|
23779
24455
|
|
23780
24456
|
ActionHelper.registerAction = function(actionName, options) {
|
@@ -23796,14 +24472,19 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
23796
24472
|
|
23797
24473
|
container.register('controller:person', PersonController);
|
23798
24474
|
|
23799
|
-
|
24475
|
+
expectDeprecation(function() {
|
24476
|
+
appendView();
|
24477
|
+
}, 'Using the context switching form of `{{with}}` is deprecated. Please use the keyword form (`{{with foo as bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
23800
24478
|
|
23801
24479
|
ok(registeredTarget instanceof PersonController, "the with-controller is the target of action");
|
23802
24480
|
|
23803
24481
|
ActionHelper.registerAction = originalRegisterAction;
|
23804
24482
|
});
|
23805
24483
|
|
23806
|
-
test("should target the with-controller inside an {{each}} in a {{#with controller='person'}}", function() {
|
24484
|
+
test("should target the with-controller inside an {{each}} in a {{#with controller='person'}} [DEPRECATED]", function() {
|
24485
|
+
expectDeprecation('Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each foo in bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
24486
|
+
expectDeprecation('Using the context switching form of `{{with}}` is deprecated. Please use the keyword form (`{{with foo as bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
24487
|
+
|
23807
24488
|
var eventsCalled = [];
|
23808
24489
|
|
23809
24490
|
var PeopleController = EmberArrayController.extend({
|
@@ -24061,7 +24742,7 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
24061
24742
|
view = EmberView.create({
|
24062
24743
|
controller: controller,
|
24063
24744
|
items: Ember.A([1, 2, 3, 4]),
|
24064
|
-
template: EmberHandlebars.compile('{{#each view.items}}<a href="#" {{action "edit"}}>click me</a>{{/each}}')
|
24745
|
+
template: EmberHandlebars.compile('{{#each item in view.items}}<a href="#" {{action "edit"}}>click me</a>{{/each}}')
|
24065
24746
|
});
|
24066
24747
|
|
24067
24748
|
appendView();
|
@@ -24071,7 +24752,7 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
24071
24752
|
ok(eventHandlerWasCalled, "The event handler was called");
|
24072
24753
|
});
|
24073
24754
|
|
24074
|
-
test("should work properly in a #with block", function() {
|
24755
|
+
test("should work properly in a {{#with foo as bar}} block", function() {
|
24075
24756
|
var eventHandlerWasCalled = false;
|
24076
24757
|
|
24077
24758
|
var controller = EmberController.extend({
|
@@ -24081,7 +24762,7 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
24081
24762
|
view = EmberView.create({
|
24082
24763
|
controller: controller,
|
24083
24764
|
something: {ohai: 'there'},
|
24084
|
-
template: EmberHandlebars.compile('{{#with view.something}}<a href="#" {{action "edit"}}>click me</a>{{/with}}')
|
24765
|
+
template: EmberHandlebars.compile('{{#with view.something as somethingElse}}<a href="#" {{action "edit"}}>click me</a>{{/with}}')
|
24085
24766
|
});
|
24086
24767
|
|
24087
24768
|
appendView();
|
@@ -24091,6 +24772,28 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
24091
24772
|
ok(eventHandlerWasCalled, "The event handler was called");
|
24092
24773
|
});
|
24093
24774
|
|
24775
|
+
test("should work properly in a #with block [DEPRECATED]", function() {
|
24776
|
+
var eventHandlerWasCalled = false;
|
24777
|
+
|
24778
|
+
var controller = EmberController.extend({
|
24779
|
+
actions: { edit: function() { eventHandlerWasCalled = true; } }
|
24780
|
+
}).create();
|
24781
|
+
|
24782
|
+
view = EmberView.create({
|
24783
|
+
controller: controller,
|
24784
|
+
something: {ohai: 'there'},
|
24785
|
+
template: EmberHandlebars.compile('{{#with view.something}}<a href="#" {{action "edit"}}>click me</a>{{/with}}')
|
24786
|
+
});
|
24787
|
+
|
24788
|
+
expectDeprecation(function() {
|
24789
|
+
appendView();
|
24790
|
+
}, 'Using the context switching form of `{{with}}` is deprecated. Please use the keyword form (`{{with foo as bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
24791
|
+
|
24792
|
+
view.$('a').trigger('click');
|
24793
|
+
|
24794
|
+
ok(eventHandlerWasCalled, "The event handler was called");
|
24795
|
+
});
|
24796
|
+
|
24094
24797
|
test("should unregister event handlers on rerender", function() {
|
24095
24798
|
var eventHandlerWasCalled = false;
|
24096
24799
|
|
@@ -24121,7 +24824,7 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
24121
24824
|
}
|
24122
24825
|
]);
|
24123
24826
|
view = EmberView.create({
|
24124
|
-
template: EmberHandlebars.compile('{{#each view.things}}<a href="#" {{action "edit"}}>click me</a>{{/each}}'),
|
24827
|
+
template: EmberHandlebars.compile('{{#each thing in view.things}}<a href="#" {{action "edit"}}>click me</a>{{/each}}'),
|
24125
24828
|
things: things
|
24126
24829
|
});
|
24127
24830
|
|
@@ -24234,8 +24937,8 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
24234
24937
|
var aContext = { aTarget: aTarget };
|
24235
24938
|
|
24236
24939
|
view = EmberView.create({
|
24237
|
-
|
24238
|
-
template: EmberHandlebars.compile('
|
24940
|
+
context: aContext,
|
24941
|
+
template: EmberHandlebars.compile('<a id="edit" href="#" {{action "edit" this target="aTarget"}}>edit</a>')
|
24239
24942
|
});
|
24240
24943
|
|
24241
24944
|
appendView();
|
@@ -24485,8 +25188,8 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
24485
25188
|
deepEqual(actionOrder, ['whompWhomp', 'sloopyDookie', 'biggityBoom'], 'action name was looked up properly');
|
24486
25189
|
});
|
24487
25190
|
|
24488
|
-
test("a quoteless parameter should lookup actionName in context", function(){
|
24489
|
-
expect(
|
25191
|
+
test("a quoteless parameter should lookup actionName in context [DEPRECATED]", function(){
|
25192
|
+
expect(5);
|
24490
25193
|
var lastAction;
|
24491
25194
|
var actionOrder = [];
|
24492
25195
|
|
@@ -24514,10 +25217,12 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
24514
25217
|
}
|
24515
25218
|
}).create();
|
24516
25219
|
|
24517
|
-
|
24518
|
-
|
24519
|
-
|
24520
|
-
|
25220
|
+
expectDeprecation(function() {
|
25221
|
+
run(function() {
|
25222
|
+
view.set('controller', controller);
|
25223
|
+
view.appendTo('#qunit-fixture');
|
25224
|
+
});
|
25225
|
+
}, 'Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each foo in bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
24521
25226
|
|
24522
25227
|
var testBoundAction = function(propertyValue){
|
24523
25228
|
run(function(){
|
@@ -25059,7 +25764,7 @@ enifed("ember-routing-handlebars/tests/helpers/outlet_test",
|
|
25059
25764
|
equal(trim(view.$().text()), 'HI');
|
25060
25765
|
});
|
25061
25766
|
|
25062
|
-
test("Outlets bind to the current template's view, not inner contexts", function() {
|
25767
|
+
test("Outlets bind to the current template's view, not inner contexts [DEPRECATED]", function() {
|
25063
25768
|
var parentTemplate = "<h1>HI</h1>{{#if view.alwaysTrue}}{{#with this}}{{outlet}}{{/with}}{{/if}}";
|
25064
25769
|
var bottomTemplate = "<h3>BOTTOM</h3>";
|
25065
25770
|
|
@@ -25072,7 +25777,9 @@ enifed("ember-routing-handlebars/tests/helpers/outlet_test",
|
|
25072
25777
|
template: compile(bottomTemplate)
|
25073
25778
|
});
|
25074
25779
|
|
25075
|
-
|
25780
|
+
expectDeprecation(function() {
|
25781
|
+
appendView(view);
|
25782
|
+
}, 'Using the context switching form of `{{with}}` is deprecated. Please use the keyword form (`{{with foo as bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
25076
25783
|
|
25077
25784
|
run(function() {
|
25078
25785
|
view.connectOutlet('main', bottomView);
|
@@ -30439,8 +31146,8 @@ enifed("ember-runtime/tests/controllers/array_controller_test.jshint",
|
|
30439
31146
|
});
|
30440
31147
|
});
|
30441
31148
|
enifed("ember-runtime/tests/controllers/controller_test",
|
30442
|
-
["ember-runtime/controllers/controller","ember-runtime/system/service","ember-runtime/controllers/object_controller","ember-metal/mixin","ember-runtime/system/object","ember-runtime/system/container","ember-runtime/inject"],
|
30443
|
-
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__) {
|
31149
|
+
["ember-runtime/controllers/controller","ember-runtime/system/service","ember-runtime/controllers/object_controller","ember-metal/mixin","ember-runtime/system/object","ember-runtime/system/container","ember-runtime/inject","ember-metal/property_get"],
|
31150
|
+
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__) {
|
30444
31151
|
"use strict";
|
30445
31152
|
var Controller = __dependency1__["default"];
|
30446
31153
|
var Service = __dependency2__["default"];
|
@@ -30449,6 +31156,7 @@ enifed("ember-runtime/tests/controllers/controller_test",
|
|
30449
31156
|
var Object = __dependency5__["default"];
|
30450
31157
|
var Container = __dependency6__["default"];
|
30451
31158
|
var inject = __dependency7__["default"];
|
31159
|
+
var get = __dependency8__.get;
|
30452
31160
|
|
30453
31161
|
QUnit.module('Controller event handling');
|
30454
31162
|
|
@@ -30609,13 +31317,16 @@ enifed("ember-runtime/tests/controllers/controller_test",
|
|
30609
31317
|
});
|
30610
31318
|
|
30611
31319
|
test("specifying `content` (with `model` specified) does not result in deprecation", function() {
|
30612
|
-
expect(
|
31320
|
+
expect(3);
|
30613
31321
|
expectNoDeprecation();
|
30614
31322
|
|
30615
|
-
Controller.extend({
|
31323
|
+
var controller = Controller.extend({
|
30616
31324
|
content: 'foo-bar',
|
30617
31325
|
model: 'blammo'
|
30618
31326
|
}).create();
|
31327
|
+
|
31328
|
+
equal(get(controller, 'content'), 'foo-bar');
|
31329
|
+
equal(get(controller, 'model'), 'blammo');
|
30619
31330
|
});
|
30620
31331
|
|
30621
31332
|
});
|
@@ -34165,6 +34876,8 @@ enifed("ember-runtime/tests/mixins/action_handler_test",
|
|
34165
34876
|
var run = __dependency1__["default"];
|
34166
34877
|
var Controller = __dependency2__["default"];
|
34167
34878
|
|
34879
|
+
QUnit.module("ActionHandler");
|
34880
|
+
|
34168
34881
|
test("passing a function for the actions hash triggers an assertion", function() {
|
34169
34882
|
expect(1);
|
34170
34883
|
|
@@ -43372,7 +44085,6 @@ enifed("ember-runtime/tests/system/set/copyable_suite_test",
|
|
43372
44085
|
var generateGuid = __dependency3__.generateGuid;
|
43373
44086
|
var get = __dependency4__.get;
|
43374
44087
|
|
43375
|
-
ignoreDeprecation(function() {
|
43376
44088
|
CopyableTests.extend({
|
43377
44089
|
name: 'Ember.Set Copyable',
|
43378
44090
|
|
@@ -43406,8 +44118,6 @@ enifed("ember-runtime/tests/system/set/copyable_suite_test",
|
|
43406
44118
|
|
43407
44119
|
shouldBeFreezable: true
|
43408
44120
|
}).run();
|
43409
|
-
|
43410
|
-
});
|
43411
44121
|
});
|
43412
44122
|
enifed("ember-runtime/tests/system/set/copyable_suite_test.jshint",
|
43413
44123
|
[],
|
@@ -48069,8 +48779,8 @@ enifed("ember-views/tests/views/collection_test.jshint",
|
|
48069
48779
|
});
|
48070
48780
|
});
|
48071
48781
|
enifed("ember-views/tests/views/component_test",
|
48072
|
-
["ember-metal/property_set","ember-metal/run_loop","ember-runtime/system/object","ember-runtime/system/service","ember-runtime/system/container","ember-runtime/inject","ember-views/views/view","ember-views/views/component"],
|
48073
|
-
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__) {
|
48782
|
+
["ember-metal/property_set","ember-metal/run_loop","ember-runtime/system/object","ember-runtime/system/service","ember-runtime/system/container","ember-runtime/inject","ember-metal/property_get","ember-views/views/view","ember-views/views/component"],
|
48783
|
+
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__) {
|
48074
48784
|
"use strict";
|
48075
48785
|
var set = __dependency1__.set;
|
48076
48786
|
var run = __dependency2__["default"];
|
@@ -48078,9 +48788,10 @@ enifed("ember-views/tests/views/component_test",
|
|
48078
48788
|
var Service = __dependency4__["default"];
|
48079
48789
|
var Container = __dependency5__["default"];
|
48080
48790
|
var inject = __dependency6__["default"];
|
48791
|
+
var get = __dependency7__.get;
|
48081
48792
|
|
48082
|
-
var EmberView =
|
48083
|
-
var Component =
|
48793
|
+
var EmberView = __dependency8__["default"];
|
48794
|
+
var Component = __dependency9__["default"];
|
48084
48795
|
|
48085
48796
|
var a_slice = Array.prototype.slice;
|
48086
48797
|
|
@@ -48146,6 +48857,9 @@ enifed("ember-views/tests/views/component_test",
|
|
48146
48857
|
templateName: 'blah-blah',
|
48147
48858
|
layoutName: 'hum-drum'
|
48148
48859
|
}).create();
|
48860
|
+
|
48861
|
+
equal(get(component, 'templateName'), 'blah-blah');
|
48862
|
+
equal(get(component, 'layoutName'), 'hum-drum');
|
48149
48863
|
});
|
48150
48864
|
|
48151
48865
|
test("Specifying a templateName on a component with a layoutName specified in a superclass is NOT deprecated", function(){
|
@@ -48153,9 +48867,13 @@ enifed("ember-views/tests/views/component_test",
|
|
48153
48867
|
var Parent = Component.extend({
|
48154
48868
|
layoutName: 'hum-drum'
|
48155
48869
|
});
|
48870
|
+
|
48156
48871
|
component = Parent.extend({
|
48157
48872
|
templateName: 'blah-blah'
|
48158
48873
|
}).create();
|
48874
|
+
|
48875
|
+
equal(get(component, 'templateName'), 'blah-blah');
|
48876
|
+
equal(get(component, 'layoutName'), 'hum-drum');
|
48159
48877
|
});
|
48160
48878
|
|
48161
48879
|
QUnit.module("Ember.Component - Actions", {
|
@@ -48256,7 +48974,45 @@ enifed("ember-views/tests/views/component_test",
|
|
48256
48974
|
deepEqual(actionArguments, [firstContext, secondContext], "arguments were sent to the action");
|
48257
48975
|
});
|
48258
48976
|
|
48977
|
+
|
48978
|
+
|
48979
|
+
QUnit.module('Ember.Component - subscribed and sent actions trigger errors');
|
48980
|
+
|
48981
|
+
test('something', function() {
|
48982
|
+
expect(2);
|
48983
|
+
|
48984
|
+
var appComponent = Component.extend({
|
48985
|
+
actions: {
|
48986
|
+
foo: function(message) {
|
48987
|
+
equal('bar', message);
|
48988
|
+
}
|
48989
|
+
}
|
48990
|
+
}).create();
|
48991
|
+
|
48992
|
+
appComponent.send('foo', 'bar');
|
48993
|
+
|
48994
|
+
throws(function() {
|
48995
|
+
appComponent.send('baz', 'bar');
|
48996
|
+
}, /had no action handler for: baz/, 'asdf');
|
48997
|
+
});
|
48998
|
+
|
48999
|
+
test('component with target', function() {
|
49000
|
+
expect(2);
|
49001
|
+
|
49002
|
+
var target = {
|
49003
|
+
send: function(message, payload) {
|
49004
|
+
equal('foo', message);
|
49005
|
+
equal('baz', payload);
|
49006
|
+
}
|
49007
|
+
};
|
49008
|
+
|
49009
|
+
var appComponent = Component.create({
|
49010
|
+
target: target
|
48259
49011
|
});
|
49012
|
+
|
49013
|
+
appComponent.send('foo', 'baz');
|
49014
|
+
});
|
49015
|
+
});
|
48260
49016
|
enifed("ember-views/tests/views/component_test.jshint",
|
48261
49017
|
[],
|
48262
49018
|
function() {
|
@@ -52269,10 +53025,12 @@ enifed("ember-views/tests/views/view/state_deprecation_test",
|
|
52269
53025
|
}
|
52270
53026
|
|
52271
53027
|
test("no deprecation is printed if view.state or view._state is not looked up", function() {
|
52272
|
-
expect(
|
53028
|
+
expect(2);
|
52273
53029
|
expectNoDeprecation();
|
52274
53030
|
|
52275
|
-
EmberView.create();
|
53031
|
+
var view = EmberView.create();
|
53032
|
+
|
53033
|
+
ok(view, 'view was created');
|
52276
53034
|
});
|
52277
53035
|
});
|
52278
53036
|
enifed("ember-views/tests/views/view/state_deprecation_test.jshint",
|
@@ -53523,6 +54281,14 @@ enifed("ember/tests/component_registration_test",
|
|
53523
54281
|
equal(Ember.$('#wrapper').text(), "inner-outer", "The component is composed correctly");
|
53524
54282
|
});
|
53525
54283
|
|
54284
|
+
test('Using name of component that does not exist', function () {
|
54285
|
+
Ember.TEMPLATES.application = compile("<div id='wrapper'>{{#no-good}} {{/no-good}}</div>");
|
54286
|
+
|
54287
|
+
throws(function () {
|
54288
|
+
boot();
|
54289
|
+
}, /Could not find component or helper named 'no-good'/);
|
54290
|
+
});
|
54291
|
+
|
53526
54292
|
QUnit.module("Application Lifecycle - Component Context", {
|
53527
54293
|
setup: prepare,
|
53528
54294
|
teardown: cleanup
|
@@ -54261,7 +55027,7 @@ enifed("ember/tests/helpers/link_to_test",
|
|
54261
55027
|
this.resource("item", { path: "/item/:id" });
|
54262
55028
|
});
|
54263
55029
|
|
54264
|
-
Ember.TEMPLATES.about = Ember.Handlebars.compile("<h3>List</h3><ul>{{#each controller}}<li>{{#link-to 'item'
|
55030
|
+
Ember.TEMPLATES.about = Ember.Handlebars.compile("<h3>List</h3><ul>{{#each person in controller}}<li>{{#link-to 'item' person}}{{person.name}}{{/link-to}}</li>{{/each}}</ul>{{#link-to 'index' id='home-link'}}Home{{/link-to}}");
|
54265
55031
|
|
54266
55032
|
App.AboutRoute = Ember.Route.extend({
|
54267
55033
|
model: function() {
|
@@ -54741,7 +55507,9 @@ enifed("ember/tests/helpers/link_to_test",
|
|
54741
55507
|
index: compile('{{#each routeName in routeNames}}{{#link-to routeName}}{{routeName}}{{/link-to}}{{/each}}{{#each routeNames}}{{#link-to this}}{{this}}{{/link-to}}{{/each}}{{#link-to route1}}a{{/link-to}}{{#link-to route2}}b{{/link-to}}')
|
54742
55508
|
};
|
54743
55509
|
|
54744
|
-
|
55510
|
+
expectDeprecation(function() {
|
55511
|
+
bootApplication();
|
55512
|
+
}, 'Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each foo in bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');
|
54745
55513
|
|
54746
55514
|
function linksEqual($links, expected) {
|
54747
55515
|
equal($links.length, expected.length, "Has correct number of links");
|
@@ -54856,7 +55624,7 @@ enifed("ember/tests/helpers/link_to_test",
|
|
54856
55624
|
}
|
54857
55625
|
});
|
54858
55626
|
|
54859
|
-
Ember.TEMPLATES.index = Ember.Handlebars.compile("<h3>Home</h3><ul>{{#each controller}}<li>{{link-to name 'item'
|
55627
|
+
Ember.TEMPLATES.index = Ember.Handlebars.compile("<h3>Home</h3><ul>{{#each person in controller}}<li>{{link-to person.name 'item' person}}</li>{{/each}}</ul>");
|
54860
55628
|
Ember.TEMPLATES.item = Ember.Handlebars.compile("<h3>Item</h3><p>{{name}}</p>{{#link-to 'index' id='home-link'}}Home{{/link-to}}");
|
54861
55629
|
|
54862
55630
|
bootApplication();
|
@@ -55588,7 +56356,7 @@ enifed("ember/tests/homepage_example_test",
|
|
55588
56356
|
function setupExample() {
|
55589
56357
|
// setup templates
|
55590
56358
|
Ember.TEMPLATES.application = Ember.Handlebars.compile("{{outlet}}");
|
55591
|
-
Ember.TEMPLATES.index = Ember.Handlebars.compile("<h1>People</h1><ul>{{#each model}}<li>Hello, <b>{{fullName}}</b>!</li>{{/each}}</ul>");
|
56359
|
+
Ember.TEMPLATES.index = Ember.Handlebars.compile("<h1>People</h1><ul>{{#each person in model}}<li>Hello, <b>{{person.fullName}}</b>!</li>{{/each}}</ul>");
|
55592
56360
|
|
55593
56361
|
|
55594
56362
|
App.Person = Ember.Object.extend({
|
@@ -56385,7 +57153,7 @@ enifed("ember/tests/routing/basic_test",
|
|
56385
57153
|
});
|
56386
57154
|
|
56387
57155
|
Ember.TEMPLATES.home = Ember.Handlebars.compile(
|
56388
|
-
"<ul>{{#each}}<li>{{
|
57156
|
+
"<ul>{{#each passage in model}}<li>{{passage}}</li>{{/each}}</ul>"
|
56389
57157
|
);
|
56390
57158
|
|
56391
57159
|
bootApplication();
|