1
1
import {
2
- registerHandlebarsCompatibleHelper
2
+ registerHandlebarsCompatibleHelper as registerHelper
3
3
} from 'ember-htmlbars/compat/helper' ;
4
4
5
5
import EmberView from 'ember-views/views/view' ;
@@ -18,6 +18,12 @@ import viewKeyword from 'ember-htmlbars/keywords/view';
18
18
19
19
var view , registry , container , originalViewKeyword ;
20
20
21
+ function registerHandlebarsCompatibleHelper ( ) {
22
+ expectDeprecation ( 'Ember.Handlebars.registerHelper is deprecated, please refactor to Ember.Helper.helper.' ) ;
23
+
24
+ return registerHelper ( ...arguments ) ;
25
+ }
26
+
21
27
QUnit . module ( 'ember-htmlbars: compat - Handlebars compatible helpers' , {
22
28
setup ( ) {
23
29
originalViewKeyword = registerKeyword ( 'view' , viewKeyword ) ;
@@ -40,7 +46,7 @@ QUnit.module('ember-htmlbars: compat - Handlebars compatible helpers', {
40
46
} ) ;
41
47
42
48
QUnit . test ( 'wraps provided function so that original path params are provided to the helper' , function ( ) {
43
- expect ( 2 ) ;
49
+ expect ( 3 ) ;
44
50
45
51
function someHelper ( param1 , param2 , options ) {
46
52
equal ( param1 , 'blammo' ) ;
@@ -60,7 +66,7 @@ QUnit.test('wraps provided function so that original path params are provided to
60
66
} ) ;
61
67
62
68
QUnit . test ( 'combines `env` and `options` for the wrapped helper' , function ( ) {
63
- expect ( 1 ) ;
69
+ expect ( 2 ) ;
64
70
65
71
function someHelper ( options ) {
66
72
equal ( options . data . view , view ) ;
@@ -79,7 +85,7 @@ QUnit.test('combines `env` and `options` for the wrapped helper', function() {
79
85
} ) ;
80
86
81
87
QUnit . test ( 'combines `env` and `options` for the wrapped helper' , function ( ) {
82
- expect ( 1 ) ;
88
+ expect ( 2 ) ;
83
89
84
90
function someHelper ( options ) {
85
91
equal ( options . data . view , view ) ;
@@ -122,7 +128,7 @@ QUnit.test('has the correct options.data.view within a components layout', funct
122
128
} ) ;
123
129
124
130
QUnit . test ( 'adds `hash` into options `options` for the wrapped helper' , function ( ) {
125
- expect ( 1 ) ;
131
+ expect ( 2 ) ;
126
132
127
133
function someHelper ( options ) {
128
134
equal ( options . hash . bestFriend , 'Jacquie' ) ;
@@ -141,7 +147,7 @@ QUnit.test('adds `hash` into options `options` for the wrapped helper', function
141
147
} ) ;
142
148
143
149
QUnit . test ( 'bound `hash` params are provided with their original paths' , function ( ) {
144
- expect ( 1 ) ;
150
+ expect ( 2 ) ;
145
151
146
152
function someHelper ( options ) {
147
153
equal ( options . hash . bestFriend , 'value' ) ;
@@ -160,7 +166,7 @@ QUnit.test('bound `hash` params are provided with their original paths', functio
160
166
} ) ;
161
167
162
168
QUnit . test ( 'bound ordered params are provided with their original paths' , function ( ) {
163
- expect ( 2 ) ;
169
+ expect ( 3 ) ;
164
170
165
171
function someHelper ( param1 , param2 , options ) {
166
172
equal ( param1 , 'first' ) ;
@@ -181,7 +187,7 @@ QUnit.test('bound ordered params are provided with their original paths', functi
181
187
} ) ;
182
188
183
189
QUnit . test ( 'registering a helper created from `Ember.Handlebars.makeViewHelper` does not double wrap the helper' , function ( ) {
184
- expect ( 2 ) ;
190
+ expect ( 3 ) ;
185
191
186
192
var ViewHelperComponent = Component . extend ( {
187
193
layout : compile ( 'woot!' )
@@ -204,7 +210,7 @@ QUnit.test('registering a helper created from `Ember.Handlebars.makeViewHelper`
204
210
} ) ;
205
211
206
212
QUnit . test ( 'makes helpful assertion when called with invalid arguments' , function ( ) {
207
- expect ( 2 ) ;
213
+ expect ( 3 ) ;
208
214
209
215
var ViewHelperComponent = Component . extend ( {
210
216
layout : compile ( 'woot!' )
@@ -228,7 +234,7 @@ QUnit.test('makes helpful assertion when called with invalid arguments', functio
228
234
} ) ;
229
235
230
236
QUnit . test ( 'does not add `options.fn` if no block was specified' , function ( ) {
231
- expect ( 1 ) ;
237
+ expect ( 2 ) ;
232
238
233
239
function someHelper ( options ) {
234
240
ok ( ! options . fn , '`options.fn` is not present when block is not specified' ) ;
@@ -247,7 +253,7 @@ QUnit.test('does not add `options.fn` if no block was specified', function() {
247
253
} ) ;
248
254
249
255
QUnit . test ( 'does not return helper result if block was specified' , function ( ) {
250
- expect ( 1 ) ;
256
+ expect ( 2 ) ;
251
257
252
258
function someHelper ( options ) {
253
259
return 'asdf' ;
@@ -268,7 +274,7 @@ QUnit.test('does not return helper result if block was specified', function() {
268
274
} ) ;
269
275
270
276
QUnit . test ( 'allows usage of the template fn' , function ( ) {
271
- expect ( 1 ) ;
277
+ expect ( 2 ) ;
272
278
273
279
function someHelper ( options ) {
274
280
options . fn ( ) ;
@@ -289,7 +295,7 @@ QUnit.test('allows usage of the template fn', function() {
289
295
} ) ;
290
296
291
297
QUnit . test ( 'allows usage of the template inverse' , function ( ) {
292
- expect ( 1 ) ;
298
+ expect ( 2 ) ;
293
299
294
300
function someHelper ( options ) {
295
301
options . inverse ( ) ;
@@ -310,7 +316,7 @@ QUnit.test('allows usage of the template inverse', function() {
310
316
} ) ;
311
317
312
318
QUnit . test ( 'ordered param types are added to options.types' , function ( ) {
313
- expect ( 3 ) ;
319
+ expect ( 4 ) ;
314
320
315
321
function someHelper ( param1 , param2 , param3 , options ) {
316
322
equal ( options . types [ 0 ] , 'NUMBER' ) ;
@@ -332,7 +338,7 @@ QUnit.test('ordered param types are added to options.types', function() {
332
338
} ) ;
333
339
334
340
QUnit . test ( '`hash` params are to options.hashTypes' , function ( ) {
335
- expect ( 3 ) ;
341
+ expect ( 4 ) ;
336
342
337
343
function someHelper ( options ) {
338
344
equal ( options . hashTypes . string , 'STRING' ) ;
0 commit comments