ember-source 1.9.0.beta.1.1 → 1.9.0.beta.3
Sign up to get free protection for your applications and to get access to all the features.
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-testing.js
CHANGED
data/dist/ember-tests.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
|
});
|
@@ -15984,7 +16726,7 @@ enifed("ember-metal/tests/computed_test",
|
|
15984
16726
|
equal(get(obj, 'foo'), 'foo 3', 'cached retrieve');
|
15985
16727
|
});
|
15986
16728
|
|
15987
|
-
testBoth('redefining a property should undo old
|
16729
|
+
testBoth('redefining a property should undo old dependent keys', function(get ,set) {
|
15988
16730
|
|
15989
16731
|
equal(isWatching(obj, 'bar'), false, 'precond not watching dependent key');
|
15990
16732
|
equal(get(obj, 'foo'), 'bar 1');
|
@@ -21429,70 +22171,6 @@ enifed("ember-metal/tests/run_loop/debounce_test.jshint",
|
|
21429
22171
|
ok(true, 'ember-metal/tests/run_loop/debounce_test.js should pass jshint.');
|
21430
22172
|
});
|
21431
22173
|
});
|
21432
|
-
enifed("ember-metal/tests/run_loop/join_test",
|
21433
|
-
["ember-metal/run_loop"],
|
21434
|
-
function(__dependency1__) {
|
21435
|
-
"use strict";
|
21436
|
-
var run = __dependency1__["default"];
|
21437
|
-
|
21438
|
-
QUnit.module('system/run_loop/join_test');
|
21439
|
-
|
21440
|
-
test('run.join brings its own run loop if none provided', function() {
|
21441
|
-
ok(!run.currentRunLoop, 'expects no existing run-loop');
|
21442
|
-
|
21443
|
-
run.join(function() {
|
21444
|
-
ok(run.currentRunLoop, 'brings its own run loop');
|
21445
|
-
});
|
21446
|
-
});
|
21447
|
-
|
21448
|
-
test('run.join joins and existing run-loop, and fires its action queue.', function() {
|
21449
|
-
var outerRunLoop, wasInvoked;
|
21450
|
-
|
21451
|
-
run(function() {
|
21452
|
-
outerRunLoop = run.currentRunLoop;
|
21453
|
-
|
21454
|
-
run.join(function() {
|
21455
|
-
wasInvoked = true;
|
21456
|
-
deepEqual(outerRunLoop, run.currentRunLoop, 'joined the existing run-loop');
|
21457
|
-
});
|
21458
|
-
|
21459
|
-
ok(!wasInvoked, 'expected the joined callback not be invoked yet');
|
21460
|
-
});
|
21461
|
-
ok(wasInvoked, 'expected the joined callback to have invoked');
|
21462
|
-
});
|
21463
|
-
|
21464
|
-
test('run.join returns a value if creating a new run-loop', function() {
|
21465
|
-
var value = 'returned value';
|
21466
|
-
|
21467
|
-
var result = run.join(function() {
|
21468
|
-
return value;
|
21469
|
-
});
|
21470
|
-
|
21471
|
-
equal(value, result, 'returns expected output');
|
21472
|
-
});
|
21473
|
-
|
21474
|
-
test('run.join returns undefined if joining another run-loop', function() {
|
21475
|
-
var value = 'returned value';
|
21476
|
-
var result;
|
21477
|
-
|
21478
|
-
run(function() {
|
21479
|
-
result = run.join(function() {
|
21480
|
-
return value;
|
21481
|
-
});
|
21482
|
-
});
|
21483
|
-
|
21484
|
-
equal(result, undefined, 'returns nothing');
|
21485
|
-
});
|
21486
|
-
});
|
21487
|
-
enifed("ember-metal/tests/run_loop/join_test.jshint",
|
21488
|
-
[],
|
21489
|
-
function() {
|
21490
|
-
"use strict";
|
21491
|
-
module('JSHint - ember-metal/tests/run_loop');
|
21492
|
-
test('ember-metal/tests/run_loop/join_test.js should pass jshint', function() {
|
21493
|
-
ok(true, 'ember-metal/tests/run_loop/join_test.js should pass jshint.');
|
21494
|
-
});
|
21495
|
-
});
|
21496
22174
|
enifed("ember-metal/tests/run_loop/later_test",
|
21497
22175
|
["ember-metal/is_none","ember-metal/run_loop"],
|
21498
22176
|
function(__dependency1__, __dependency2__) {
|
@@ -23777,7 +24455,7 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
23777
24455
|
boundText: "inner",
|
23778
24456
|
truthy: true,
|
23779
24457
|
obj: {},
|
23780
|
-
layout: EmberHandlebars.compile("<div>{{boundText}}</div><div>{{#if truthy}}{{
|
24458
|
+
layout: EmberHandlebars.compile("<div>{{boundText}}</div><div>{{#if truthy}}{{yield}}{{/if}}</div>")
|
23781
24459
|
});
|
23782
24460
|
|
23783
24461
|
view = EmberView.create({
|
@@ -23787,13 +24465,9 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
23787
24465
|
wat: function() {
|
23788
24466
|
watted = true;
|
23789
24467
|
},
|
23790
|
-
|
23791
|
-
component: component,
|
23792
|
-
truthy: true,
|
23793
|
-
boundText: 'insideWith'
|
23794
|
-
}
|
24468
|
+
component: component
|
23795
24469
|
},
|
23796
|
-
template: EmberHandlebars.compile('{{#
|
24470
|
+
template: EmberHandlebars.compile('{{#if truthy}}{{#view component}}{{#if truthy}}<div {{action "wat"}} class="wat">{{boundText}}</div>{{/if}}{{/view}}{{/if}}')
|
23797
24471
|
});
|
23798
24472
|
|
23799
24473
|
appendView();
|
@@ -23805,7 +24479,7 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
23805
24479
|
equal(watted, true, "The action was called on the right context");
|
23806
24480
|
});
|
23807
24481
|
|
23808
|
-
test("should target the current controller inside an {{each}} loop", function() {
|
24482
|
+
test("should target the current controller inside an {{each}} loop [DEPRECATED]", function() {
|
23809
24483
|
var registeredTarget;
|
23810
24484
|
|
23811
24485
|
ActionHelper.registerAction = function(actionName, options) {
|
@@ -23830,14 +24504,16 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
23830
24504
|
template: EmberHandlebars.compile('{{#each controller}}{{action "editTodo"}}{{/each}}')
|
23831
24505
|
});
|
23832
24506
|
|
23833
|
-
|
24507
|
+
expectDeprecation(function() {
|
24508
|
+
appendView();
|
24509
|
+
}, '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.');
|
23834
24510
|
|
23835
24511
|
equal(registeredTarget, itemController, "the item controller is the target of action");
|
23836
24512
|
|
23837
24513
|
ActionHelper.registerAction = originalRegisterAction;
|
23838
24514
|
});
|
23839
24515
|
|
23840
|
-
test("should target the with-controller inside an {{#with controller='person'}}", function() {
|
24516
|
+
test("should target the with-controller inside an {{#with controller='person'}} [DEPRECATED]", function() {
|
23841
24517
|
var registeredTarget;
|
23842
24518
|
|
23843
24519
|
ActionHelper.registerAction = function(actionName, options) {
|
@@ -23859,14 +24535,19 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
23859
24535
|
|
23860
24536
|
container.register('controller:person', PersonController);
|
23861
24537
|
|
23862
|
-
|
24538
|
+
expectDeprecation(function() {
|
24539
|
+
appendView();
|
24540
|
+
}, '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.');
|
23863
24541
|
|
23864
24542
|
ok(registeredTarget instanceof PersonController, "the with-controller is the target of action");
|
23865
24543
|
|
23866
24544
|
ActionHelper.registerAction = originalRegisterAction;
|
23867
24545
|
});
|
23868
24546
|
|
23869
|
-
test("should target the with-controller inside an {{each}} in a {{#with controller='person'}}", function() {
|
24547
|
+
test("should target the with-controller inside an {{each}} in a {{#with controller='person'}} [DEPRECATED]", function() {
|
24548
|
+
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.');
|
24549
|
+
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.');
|
24550
|
+
|
23870
24551
|
var eventsCalled = [];
|
23871
24552
|
|
23872
24553
|
var PeopleController = EmberArrayController.extend({
|
@@ -24124,7 +24805,7 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
24124
24805
|
view = EmberView.create({
|
24125
24806
|
controller: controller,
|
24126
24807
|
items: Ember.A([1, 2, 3, 4]),
|
24127
|
-
template: EmberHandlebars.compile('{{#each view.items}}<a href="#" {{action "edit"}}>click me</a>{{/each}}')
|
24808
|
+
template: EmberHandlebars.compile('{{#each item in view.items}}<a href="#" {{action "edit"}}>click me</a>{{/each}}')
|
24128
24809
|
});
|
24129
24810
|
|
24130
24811
|
appendView();
|
@@ -24134,7 +24815,7 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
24134
24815
|
ok(eventHandlerWasCalled, "The event handler was called");
|
24135
24816
|
});
|
24136
24817
|
|
24137
|
-
test("should work properly in a #with block", function() {
|
24818
|
+
test("should work properly in a {{#with foo as bar}} block", function() {
|
24138
24819
|
var eventHandlerWasCalled = false;
|
24139
24820
|
|
24140
24821
|
var controller = EmberController.extend({
|
@@ -24144,7 +24825,7 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
24144
24825
|
view = EmberView.create({
|
24145
24826
|
controller: controller,
|
24146
24827
|
something: {ohai: 'there'},
|
24147
|
-
template: EmberHandlebars.compile('{{#with view.something}}<a href="#" {{action "edit"}}>click me</a>{{/with}}')
|
24828
|
+
template: EmberHandlebars.compile('{{#with view.something as somethingElse}}<a href="#" {{action "edit"}}>click me</a>{{/with}}')
|
24148
24829
|
});
|
24149
24830
|
|
24150
24831
|
appendView();
|
@@ -24154,6 +24835,28 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
24154
24835
|
ok(eventHandlerWasCalled, "The event handler was called");
|
24155
24836
|
});
|
24156
24837
|
|
24838
|
+
test("should work properly in a #with block [DEPRECATED]", function() {
|
24839
|
+
var eventHandlerWasCalled = false;
|
24840
|
+
|
24841
|
+
var controller = EmberController.extend({
|
24842
|
+
actions: { edit: function() { eventHandlerWasCalled = true; } }
|
24843
|
+
}).create();
|
24844
|
+
|
24845
|
+
view = EmberView.create({
|
24846
|
+
controller: controller,
|
24847
|
+
something: {ohai: 'there'},
|
24848
|
+
template: EmberHandlebars.compile('{{#with view.something}}<a href="#" {{action "edit"}}>click me</a>{{/with}}')
|
24849
|
+
});
|
24850
|
+
|
24851
|
+
expectDeprecation(function() {
|
24852
|
+
appendView();
|
24853
|
+
}, '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.');
|
24854
|
+
|
24855
|
+
view.$('a').trigger('click');
|
24856
|
+
|
24857
|
+
ok(eventHandlerWasCalled, "The event handler was called");
|
24858
|
+
});
|
24859
|
+
|
24157
24860
|
test("should unregister event handlers on rerender", function() {
|
24158
24861
|
var eventHandlerWasCalled = false;
|
24159
24862
|
|
@@ -24184,7 +24887,7 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
24184
24887
|
}
|
24185
24888
|
]);
|
24186
24889
|
view = EmberView.create({
|
24187
|
-
template: EmberHandlebars.compile('{{#each view.things}}<a href="#" {{action "edit"}}>click me</a>{{/each}}'),
|
24890
|
+
template: EmberHandlebars.compile('{{#each thing in view.things}}<a href="#" {{action "edit"}}>click me</a>{{/each}}'),
|
24188
24891
|
things: things
|
24189
24892
|
});
|
24190
24893
|
|
@@ -24297,8 +25000,8 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
24297
25000
|
var aContext = { aTarget: aTarget };
|
24298
25001
|
|
24299
25002
|
view = EmberView.create({
|
24300
|
-
|
24301
|
-
template: EmberHandlebars.compile('
|
25003
|
+
context: aContext,
|
25004
|
+
template: EmberHandlebars.compile('<a id="edit" href="#" {{action "edit" this target="aTarget"}}>edit</a>')
|
24302
25005
|
});
|
24303
25006
|
|
24304
25007
|
appendView();
|
@@ -24548,8 +25251,8 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
24548
25251
|
deepEqual(actionOrder, ['whompWhomp', 'sloopyDookie', 'biggityBoom'], 'action name was looked up properly');
|
24549
25252
|
});
|
24550
25253
|
|
24551
|
-
test("a quoteless parameter should lookup actionName in context", function(){
|
24552
|
-
expect(
|
25254
|
+
test("a quoteless parameter should lookup actionName in context [DEPRECATED]", function(){
|
25255
|
+
expect(5);
|
24553
25256
|
var lastAction;
|
24554
25257
|
var actionOrder = [];
|
24555
25258
|
|
@@ -24577,10 +25280,12 @@ enifed("ember-routing-handlebars/tests/helpers/action_test",
|
|
24577
25280
|
}
|
24578
25281
|
}).create();
|
24579
25282
|
|
24580
|
-
|
24581
|
-
|
24582
|
-
|
24583
|
-
|
25283
|
+
expectDeprecation(function() {
|
25284
|
+
run(function() {
|
25285
|
+
view.set('controller', controller);
|
25286
|
+
view.appendTo('#qunit-fixture');
|
25287
|
+
});
|
25288
|
+
}, '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.');
|
24584
25289
|
|
24585
25290
|
var testBoundAction = function(propertyValue){
|
24586
25291
|
run(function(){
|
@@ -25122,7 +25827,7 @@ enifed("ember-routing-handlebars/tests/helpers/outlet_test",
|
|
25122
25827
|
equal(trim(view.$().text()), 'HI');
|
25123
25828
|
});
|
25124
25829
|
|
25125
|
-
test("Outlets bind to the current template's view, not inner contexts", function() {
|
25830
|
+
test("Outlets bind to the current template's view, not inner contexts [DEPRECATED]", function() {
|
25126
25831
|
var parentTemplate = "<h1>HI</h1>{{#if view.alwaysTrue}}{{#with this}}{{outlet}}{{/with}}{{/if}}";
|
25127
25832
|
var bottomTemplate = "<h3>BOTTOM</h3>";
|
25128
25833
|
|
@@ -25135,7 +25840,9 @@ enifed("ember-routing-handlebars/tests/helpers/outlet_test",
|
|
25135
25840
|
template: compile(bottomTemplate)
|
25136
25841
|
});
|
25137
25842
|
|
25138
|
-
|
25843
|
+
expectDeprecation(function() {
|
25844
|
+
appendView(view);
|
25845
|
+
}, '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.');
|
25139
25846
|
|
25140
25847
|
run(function() {
|
25141
25848
|
view.connectOutlet('main', bottomView);
|
@@ -30502,8 +31209,8 @@ enifed("ember-runtime/tests/controllers/array_controller_test.jshint",
|
|
30502
31209
|
});
|
30503
31210
|
});
|
30504
31211
|
enifed("ember-runtime/tests/controllers/controller_test",
|
30505
|
-
["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"],
|
30506
|
-
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__) {
|
31212
|
+
["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"],
|
31213
|
+
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__) {
|
30507
31214
|
"use strict";
|
30508
31215
|
var Controller = __dependency1__["default"];
|
30509
31216
|
var Service = __dependency2__["default"];
|
@@ -30512,6 +31219,7 @@ enifed("ember-runtime/tests/controllers/controller_test",
|
|
30512
31219
|
var Object = __dependency5__["default"];
|
30513
31220
|
var Container = __dependency6__["default"];
|
30514
31221
|
var inject = __dependency7__["default"];
|
31222
|
+
var get = __dependency8__.get;
|
30515
31223
|
|
30516
31224
|
QUnit.module('Controller event handling');
|
30517
31225
|
|
@@ -30672,13 +31380,16 @@ enifed("ember-runtime/tests/controllers/controller_test",
|
|
30672
31380
|
});
|
30673
31381
|
|
30674
31382
|
test("specifying `content` (with `model` specified) does not result in deprecation", function() {
|
30675
|
-
expect(
|
31383
|
+
expect(3);
|
30676
31384
|
expectNoDeprecation();
|
30677
31385
|
|
30678
|
-
Controller.extend({
|
31386
|
+
var controller = Controller.extend({
|
30679
31387
|
content: 'foo-bar',
|
30680
31388
|
model: 'blammo'
|
30681
31389
|
}).create();
|
31390
|
+
|
31391
|
+
equal(get(controller, 'content'), 'foo-bar');
|
31392
|
+
equal(get(controller, 'model'), 'blammo');
|
30682
31393
|
});
|
30683
31394
|
|
30684
31395
|
});
|
@@ -34228,6 +34939,8 @@ enifed("ember-runtime/tests/mixins/action_handler_test",
|
|
34228
34939
|
var run = __dependency1__["default"];
|
34229
34940
|
var Controller = __dependency2__["default"];
|
34230
34941
|
|
34942
|
+
QUnit.module("ActionHandler");
|
34943
|
+
|
34231
34944
|
test("passing a function for the actions hash triggers an assertion", function() {
|
34232
34945
|
expect(1);
|
34233
34946
|
|
@@ -43461,7 +44174,6 @@ enifed("ember-runtime/tests/system/set/copyable_suite_test",
|
|
43461
44174
|
var generateGuid = __dependency3__.generateGuid;
|
43462
44175
|
var get = __dependency4__.get;
|
43463
44176
|
|
43464
|
-
ignoreDeprecation(function() {
|
43465
44177
|
CopyableTests.extend({
|
43466
44178
|
name: 'Ember.Set Copyable',
|
43467
44179
|
|
@@ -43495,8 +44207,6 @@ enifed("ember-runtime/tests/system/set/copyable_suite_test",
|
|
43495
44207
|
|
43496
44208
|
shouldBeFreezable: true
|
43497
44209
|
}).run();
|
43498
|
-
|
43499
|
-
});
|
43500
44210
|
});
|
43501
44211
|
enifed("ember-runtime/tests/system/set/copyable_suite_test.jshint",
|
43502
44212
|
[],
|
@@ -48158,8 +48868,8 @@ enifed("ember-views/tests/views/collection_test.jshint",
|
|
48158
48868
|
});
|
48159
48869
|
});
|
48160
48870
|
enifed("ember-views/tests/views/component_test",
|
48161
|
-
["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"],
|
48162
|
-
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__) {
|
48871
|
+
["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"],
|
48872
|
+
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__) {
|
48163
48873
|
"use strict";
|
48164
48874
|
var set = __dependency1__.set;
|
48165
48875
|
var run = __dependency2__["default"];
|
@@ -48167,9 +48877,10 @@ enifed("ember-views/tests/views/component_test",
|
|
48167
48877
|
var Service = __dependency4__["default"];
|
48168
48878
|
var Container = __dependency5__["default"];
|
48169
48879
|
var inject = __dependency6__["default"];
|
48880
|
+
var get = __dependency7__.get;
|
48170
48881
|
|
48171
|
-
var EmberView =
|
48172
|
-
var Component =
|
48882
|
+
var EmberView = __dependency8__["default"];
|
48883
|
+
var Component = __dependency9__["default"];
|
48173
48884
|
|
48174
48885
|
var a_slice = Array.prototype.slice;
|
48175
48886
|
|
@@ -48235,6 +48946,9 @@ enifed("ember-views/tests/views/component_test",
|
|
48235
48946
|
templateName: 'blah-blah',
|
48236
48947
|
layoutName: 'hum-drum'
|
48237
48948
|
}).create();
|
48949
|
+
|
48950
|
+
equal(get(component, 'templateName'), 'blah-blah');
|
48951
|
+
equal(get(component, 'layoutName'), 'hum-drum');
|
48238
48952
|
});
|
48239
48953
|
|
48240
48954
|
test("Specifying a templateName on a component with a layoutName specified in a superclass is NOT deprecated", function(){
|
@@ -48242,9 +48956,13 @@ enifed("ember-views/tests/views/component_test",
|
|
48242
48956
|
var Parent = Component.extend({
|
48243
48957
|
layoutName: 'hum-drum'
|
48244
48958
|
});
|
48959
|
+
|
48245
48960
|
component = Parent.extend({
|
48246
48961
|
templateName: 'blah-blah'
|
48247
48962
|
}).create();
|
48963
|
+
|
48964
|
+
equal(get(component, 'templateName'), 'blah-blah');
|
48965
|
+
equal(get(component, 'layoutName'), 'hum-drum');
|
48248
48966
|
});
|
48249
48967
|
|
48250
48968
|
QUnit.module("Ember.Component - Actions", {
|
@@ -48345,7 +49063,45 @@ enifed("ember-views/tests/views/component_test",
|
|
48345
49063
|
deepEqual(actionArguments, [firstContext, secondContext], "arguments were sent to the action");
|
48346
49064
|
});
|
48347
49065
|
|
49066
|
+
|
49067
|
+
|
49068
|
+
QUnit.module('Ember.Component - subscribed and sent actions trigger errors');
|
49069
|
+
|
49070
|
+
test('something', function() {
|
49071
|
+
expect(2);
|
49072
|
+
|
49073
|
+
var appComponent = Component.extend({
|
49074
|
+
actions: {
|
49075
|
+
foo: function(message) {
|
49076
|
+
equal('bar', message);
|
49077
|
+
}
|
49078
|
+
}
|
49079
|
+
}).create();
|
49080
|
+
|
49081
|
+
appComponent.send('foo', 'bar');
|
49082
|
+
|
49083
|
+
throws(function() {
|
49084
|
+
appComponent.send('baz', 'bar');
|
49085
|
+
}, /had no action handler for: baz/, 'asdf');
|
49086
|
+
});
|
49087
|
+
|
49088
|
+
test('component with target', function() {
|
49089
|
+
expect(2);
|
49090
|
+
|
49091
|
+
var target = {
|
49092
|
+
send: function(message, payload) {
|
49093
|
+
equal('foo', message);
|
49094
|
+
equal('baz', payload);
|
49095
|
+
}
|
49096
|
+
};
|
49097
|
+
|
49098
|
+
var appComponent = Component.create({
|
49099
|
+
target: target
|
48348
49100
|
});
|
49101
|
+
|
49102
|
+
appComponent.send('foo', 'baz');
|
49103
|
+
});
|
49104
|
+
});
|
48349
49105
|
enifed("ember-views/tests/views/component_test.jshint",
|
48350
49106
|
[],
|
48351
49107
|
function() {
|
@@ -52358,10 +53114,12 @@ enifed("ember-views/tests/views/view/state_deprecation_test",
|
|
52358
53114
|
}
|
52359
53115
|
|
52360
53116
|
test("no deprecation is printed if view.state or view._state is not looked up", function() {
|
52361
|
-
expect(
|
53117
|
+
expect(2);
|
52362
53118
|
expectNoDeprecation();
|
52363
53119
|
|
52364
|
-
EmberView.create();
|
53120
|
+
var view = EmberView.create();
|
53121
|
+
|
53122
|
+
ok(view, 'view was created');
|
52365
53123
|
});
|
52366
53124
|
});
|
52367
53125
|
enifed("ember-views/tests/views/view/state_deprecation_test.jshint",
|
@@ -53612,6 +54370,14 @@ enifed("ember/tests/component_registration_test",
|
|
53612
54370
|
equal(Ember.$('#wrapper').text(), "inner-outer", "The component is composed correctly");
|
53613
54371
|
});
|
53614
54372
|
|
54373
|
+
test('Using name of component that does not exist', function () {
|
54374
|
+
Ember.TEMPLATES.application = compile("<div id='wrapper'>{{#no-good}} {{/no-good}}</div>");
|
54375
|
+
|
54376
|
+
throws(function () {
|
54377
|
+
boot();
|
54378
|
+
}, /Could not find component or helper named 'no-good'/);
|
54379
|
+
});
|
54380
|
+
|
53615
54381
|
QUnit.module("Application Lifecycle - Component Context", {
|
53616
54382
|
setup: prepare,
|
53617
54383
|
teardown: cleanup
|
@@ -54350,7 +55116,7 @@ enifed("ember/tests/helpers/link_to_test",
|
|
54350
55116
|
this.resource("item", { path: "/item/:id" });
|
54351
55117
|
});
|
54352
55118
|
|
54353
|
-
Ember.TEMPLATES.about = Ember.Handlebars.compile("<h3>List</h3><ul>{{#each controller}}<li>{{#link-to 'item'
|
55119
|
+
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}}");
|
54354
55120
|
|
54355
55121
|
App.AboutRoute = Ember.Route.extend({
|
54356
55122
|
model: function() {
|
@@ -54830,7 +55596,9 @@ enifed("ember/tests/helpers/link_to_test",
|
|
54830
55596
|
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}}')
|
54831
55597
|
};
|
54832
55598
|
|
54833
|
-
|
55599
|
+
expectDeprecation(function() {
|
55600
|
+
bootApplication();
|
55601
|
+
}, '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.');
|
54834
55602
|
|
54835
55603
|
function linksEqual($links, expected) {
|
54836
55604
|
equal($links.length, expected.length, "Has correct number of links");
|
@@ -54945,7 +55713,7 @@ enifed("ember/tests/helpers/link_to_test",
|
|
54945
55713
|
}
|
54946
55714
|
});
|
54947
55715
|
|
54948
|
-
Ember.TEMPLATES.index = Ember.Handlebars.compile("<h3>Home</h3><ul>{{#each controller}}<li>{{link-to name 'item'
|
55716
|
+
Ember.TEMPLATES.index = Ember.Handlebars.compile("<h3>Home</h3><ul>{{#each person in controller}}<li>{{link-to person.name 'item' person}}</li>{{/each}}</ul>");
|
54949
55717
|
Ember.TEMPLATES.item = Ember.Handlebars.compile("<h3>Item</h3><p>{{name}}</p>{{#link-to 'index' id='home-link'}}Home{{/link-to}}");
|
54950
55718
|
|
54951
55719
|
bootApplication();
|
@@ -55677,7 +56445,7 @@ enifed("ember/tests/homepage_example_test",
|
|
55677
56445
|
function setupExample() {
|
55678
56446
|
// setup templates
|
55679
56447
|
Ember.TEMPLATES.application = Ember.Handlebars.compile("{{outlet}}");
|
55680
|
-
Ember.TEMPLATES.index = Ember.Handlebars.compile("<h1>People</h1><ul>{{#each model}}<li>Hello, <b>{{fullName}}</b>!</li>{{/each}}</ul>");
|
56448
|
+
Ember.TEMPLATES.index = Ember.Handlebars.compile("<h1>People</h1><ul>{{#each person in model}}<li>Hello, <b>{{person.fullName}}</b>!</li>{{/each}}</ul>");
|
55681
56449
|
|
55682
56450
|
|
55683
56451
|
App.Person = Ember.Object.extend({
|
@@ -56474,7 +57242,7 @@ enifed("ember/tests/routing/basic_test",
|
|
56474
57242
|
});
|
56475
57243
|
|
56476
57244
|
Ember.TEMPLATES.home = Ember.Handlebars.compile(
|
56477
|
-
"<ul>{{#each}}<li>{{
|
57245
|
+
"<ul>{{#each passage in model}}<li>{{passage}}</li>{{/each}}</ul>"
|
56478
57246
|
);
|
56479
57247
|
|
56480
57248
|
bootApplication();
|