1+ import Ember from 'ember-metal/core' ;
12import EmberComponent from 'ember-views/views/component' ;
23import EmberView from 'ember-views/views/view' ;
34import EmberSelectView from 'ember-views/views/select' ;
@@ -6,7 +7,7 @@ import compile from 'ember-template-compiler/system/compile';
67import Registry from 'container/registry' ;
78
89import { registerAstPlugin , removeAstPlugin } from 'ember-htmlbars/tests/utils' ;
9- import DeprecateViewHelper from 'ember-template-compiler/plugins/deprecate -view-helper' ;
10+ import AssertNoViewHelper from 'ember-template-compiler/plugins/assert-no -view-helper' ;
1011
1112import { registerKeyword , resetKeyword } from 'ember-htmlbars/tests/utils' ;
1213import viewKeyword from 'ember-htmlbars/keywords/view' ;
@@ -15,7 +16,8 @@ let component, registry, container, originalViewKeyword;
1516
1617QUnit . module ( 'ember-htmlbars: compat - view helper' , {
1718 setup ( ) {
18- registerAstPlugin ( DeprecateViewHelper ) ;
19+ Ember . ENV . _ENABLE_LEGACY_VIEW_SUPPORT = false ;
20+ registerAstPlugin ( AssertNoViewHelper ) ;
1921
2022 originalViewKeyword = registerKeyword ( 'view' , viewKeyword ) ;
2123
@@ -25,61 +27,93 @@ QUnit.module('ember-htmlbars: compat - view helper', {
2527 teardown ( ) {
2628 runDestroy ( component ) ;
2729 runDestroy ( container ) ;
28- removeAstPlugin ( DeprecateViewHelper ) ;
30+ removeAstPlugin ( AssertNoViewHelper ) ;
31+ Ember . ENV . _ENABLE_LEGACY_VIEW_SUPPORT = true ;
2932 registry = container = component = null ;
3033
3134 resetKeyword ( 'view' , originalViewKeyword ) ;
3235 }
3336} ) ;
3437
35- QUnit . test ( 'using the view helper with a string (inline form) is deprecated [DEPRECATED] ' , function ( assert ) {
38+ QUnit . test ( 'using the view helper fails assertion ' , function ( assert ) {
3639 const ViewClass = EmberView . extend ( {
3740 template : compile ( 'fooView' )
3841 } ) ;
3942 registry . register ( 'view:foo' , ViewClass ) ;
4043
41- expectDeprecation ( function ( ) {
44+ expectAssertion ( function ( ) {
4245 component = EmberComponent . extend ( {
4346 layout : compile ( '{{view \'foo\'}}' ) ,
4447 container
4548 } ) . create ( ) ;
4649
4750 runAppend ( component ) ;
48- } , / U s i n g t h e ` { { v i e w " s t r i n g " } } ` h e l p e r i s d e p r e c a t e d / ) ;
51+ } , / U s i n g t h e ` { { v i e w " s t r i n g " } } ` h e l p e r / ) ;
52+ } ) ;
53+
54+ QUnit . module ( 'ember-htmlbars: compat - view helper [LEGACY]' , {
55+ setup ( ) {
56+ originalViewKeyword = registerKeyword ( 'view' , viewKeyword ) ;
57+
58+ registry = new Registry ( ) ;
59+ container = registry . container ( ) ;
60+ } ,
61+ teardown ( ) {
62+ runDestroy ( component ) ;
63+ runDestroy ( container ) ;
64+ registry = container = component = null ;
65+
66+ resetKeyword ( 'view' , originalViewKeyword ) ;
67+ }
68+ } ) ;
69+
70+ QUnit . test ( 'using the view helper with a string (inline form) fails assertion [LEGACY]' , function ( assert ) {
71+ const ViewClass = EmberView . extend ( {
72+ template : compile ( 'fooView' )
73+ } ) ;
74+ registry . register ( 'view:foo' , ViewClass ) ;
75+
76+ ignoreAssertion ( function ( ) {
77+ component = EmberComponent . extend ( {
78+ layout : compile ( '{{view \'foo\'}}' ) ,
79+ container
80+ } ) . create ( ) ;
81+
82+ runAppend ( component ) ;
83+ } ) ;
4984
5085 assert . equal ( component . $ ( ) . text ( ) , 'fooView' , 'view helper is still rendered' ) ;
5186} ) ;
5287
53- QUnit . test ( 'using the view helper with a string (block form) is deprecated [DEPRECATED ]' , function ( assert ) {
88+ QUnit . test ( 'using the view helper with a string (block form) fails assertion [LEGACY ]' , function ( assert ) {
5489 const ViewClass = EmberView . extend ( {
5590 template : compile ( 'Foo says: {{yield}}' )
5691 } ) ;
5792 registry . register ( 'view:foo' , ViewClass ) ;
5893
59- expectDeprecation ( function ( ) {
94+ ignoreAssertion ( function ( ) {
6095 component = EmberComponent . extend ( {
6196 layout : compile ( '{{#view \'foo\'}}I am foo{{/view}}' ) ,
6297 container
6398 } ) . create ( ) ;
6499
65100 runAppend ( component ) ;
66- } , / U s i n g t h e ` { { v i e w " s t r i n g " } } ` h e l p e r i s d e p r e c a t e d / ) ;
101+ } ) ;
67102
68103 assert . equal ( component . $ ( ) . text ( ) , 'Foo says: I am foo' , 'view helper is still rendered' ) ;
69104} ) ;
70105
71- QUnit . test ( 'using the view helper with string "select" has its own deprecation message [DEPRECATED ]' , function ( assert ) {
106+ QUnit . test ( 'using the view helper with string "select" fails assertion [LEGACY ]' , function ( assert ) {
72107 registry . register ( 'view:select' , EmberSelectView ) ;
73108
74- expectDeprecation ( function ( ) {
109+ ignoreAssertion ( function ( ) {
75110 component = EmberComponent . extend ( {
76111 layout : compile ( '{{view \'select\'}}' ) ,
77112 container
78113 } ) . create ( ) ;
79114
80115 runAppend ( component ) ;
81- } , / U s i n g ` { { v i e w " s e l e c t " } } ` i s d e p r e c a t e d / ) ;
116+ } ) ;
82117
83118 assert . ok ( ! ! component . $ ( 'select' ) . length , 'still renders select' ) ;
84119} ) ;
85-
0 commit comments