File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed
packages/@ember/-internals/glimmer
tests/integration/helpers Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -85,8 +85,9 @@ function fn({ positional }: CapturedArguments) {
85
85
if ( DEBUG && typeof callbackRef [ INVOKE ] !== 'function' ) {
86
86
let callback = callbackRef . value ( ) ;
87
87
88
+ const debug = ( < any > callbackRef ) . debug && ( < any > callbackRef ) . debug ( ) ;
88
89
assert (
89
- `You must pass a function as the \`fn\` helpers first argument, you passed ${ callback } ` ,
90
+ `You must pass a function as the \`fn\` helpers first argument, you passed ${ debug } to \`fn\` but it was ${ callback } ` ,
90
91
typeof callback === 'function'
91
92
) ;
92
93
}
Original file line number Diff line number Diff line change @@ -100,11 +100,15 @@ export class OnModifierState {
100
100
this . eventName = eventName ;
101
101
this . shouldUpdate = true ;
102
102
}
103
+ if ( DEBUG ) {
104
+ const debug = args . positional . at ( 1 ) && ( < any > args . positional . at ( 1 ) ) . debug ( ) ;
105
+ const value = args . positional . at ( 1 ) && args . positional . at ( 1 ) . value ( ) ;
106
+ assert (
107
+ `You must pass a function as the second argument to the \`on\` modifier, you passed ${ debug } to \`on\` but it was ${ value } ` ,
108
+ value !== undefined && typeof value === 'function'
109
+ ) ;
110
+ }
103
111
104
- assert (
105
- 'You must pass a function as the second argument to the `on` modifier' ,
106
- args . positional . at ( 1 ) !== undefined && typeof args . positional . at ( 1 ) . value ( ) === 'function'
107
- ) ;
108
112
let userProvidedCallback = args . positional . at ( 1 ) . value ( ) as EventListener ;
109
113
if ( userProvidedCallback !== this . userProvidedCallback ) {
110
114
this . userProvidedCallback = userProvidedCallback ;
Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ moduleFor(
127
127
arg1 : 'foo' ,
128
128
arg2 : 'bar' ,
129
129
} ) ;
130
- } , / Y o u m u s t p a s s a f u n c t i o n a s t h e ` f n ` h e l p e r s f i r s t a r g u m e n t , y o u p a s s e d n u l l / ) ;
130
+ } , / Y o u m u s t p a s s a f u n c t i o n a s t h e ` f n ` h e l p e r s f i r s t a r g u m e n t , y o u p a s s e d t h i s . m y F u n c t o ` f n ` b u t i t w a s n u l l / ) ;
131
131
}
132
132
133
133
'@test asserts if the provided function accesses `this` without being bound prior to passing to fn' (
You can’t perform that action at this time.
0 commit comments