From 4bb37130b0bcdd9fd7c115351467fb1dab267940 Mon Sep 17 00:00:00 2001 From: Godfrey Chan Date: Sat, 13 Feb 2021 12:39:55 -0800 Subject: [PATCH] [REFACTOR] support isEnabled in expectDeprecation directly --- .eslintrc.js | 1 + .../components/input-angle-test.js | 140 +++++++++--------- .../components/input-curly-test.js | 115 +++++++------- .../components/textarea-angle-test.js | 69 ++++----- .../components/textarea-curly-test.js | 69 ++++----- packages/internal-test-helpers/index.js | 1 - .../lib/ember-dev/deprecation.ts | 86 ++++++++--- .../lib/maybe-expect-deprecation.ts | 16 -- 8 files changed, 250 insertions(+), 247 deletions(-) delete mode 100644 packages/internal-test-helpers/lib/maybe-expect-deprecation.ts diff --git a/.eslintrc.js b/.eslintrc.js index 1afb795562b..15a893b3dae 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -103,6 +103,7 @@ module.exports = { expectDeprecation: true, expectDeprecationAsync: true, expectNoDeprecation: true, + expectNoDeprecationAsync: true, expectWarning: true, expectNoWarning: true, ignoreAssertion: true, diff --git a/packages/@ember/-internals/glimmer/tests/integration/components/input-angle-test.js b/packages/@ember/-internals/glimmer/tests/integration/components/input-angle-test.js index 9c1e10b6050..0a861d02a07 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/components/input-angle-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/components/input-angle-test.js @@ -1,10 +1,4 @@ -import { - RenderingTestCase, - maybeExpectDeprecation, - moduleFor, - runDestroy, - runTask, -} from 'internal-test-helpers'; +import { RenderingTestCase, moduleFor, runDestroy, runTask } from 'internal-test-helpers'; import { EMBER_MODERNIZED_BUILT_IN_COMPONENTS } from '@ember/canary-features'; import { action } from '@ember/object'; import { assign } from '@ember/polyfills'; @@ -151,12 +145,12 @@ class InputRenderingTest extends RenderingTestCase { `; - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render(template, { actions }); }, - /Passing the `@(touchStart|touchMove|touchEnd|touchCancel|keyDown|keyUp|keyPress|mouseDown|mouseUp|contextMenu|click|doubleClick|focusIn|focusOut|submit|input|change|dragStart|drag|dragEnter|dragLeave|dragOver|drop|dragEnd|mouseEnter|mouseLeave|mouseMove|focus-in|focus-out|key-press|key-up|key-down)` argument to is deprecated\./ + /Passing the `@(touchStart|touchMove|touchEnd|touchCancel|keyDown|keyUp|keyPress|mouseDown|mouseUp|contextMenu|click|doubleClick|focusIn|focusOut|submit|input|change|dragStart|drag|dragEnter|dragLeave|dragOver|drop|dragEnd|mouseEnter|mouseLeave|mouseMove|focus-in|focus-out|key-press|key-up|key-down)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assert.ok(this.$('input').length === 2); @@ -328,8 +322,7 @@ moduleFor( } ['@test [DEPRECATED] dynamic attributes (named argument)']() { - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render( ` is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|minlength|size|tabindex)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertNotDisabled(); @@ -382,8 +376,7 @@ moduleFor( // this.assertAttr('size', '20'); //NOTE: failing in IE (TEST_SUITE=sauce) // this.assertAttr('tabindex', '30'); //NOTE: failing in IE (TEST_SUITE=sauce) - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { runTask(() => { set(this.context, 'value', 'Updated value'); @@ -397,7 +390,8 @@ moduleFor( // set(this.context, 'tabindex', 31); //NOTE: failing in IE (TEST_SUITE=sauce) }); }, - /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|minlength|size|tabindex)` argument to is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|minlength|size|tabindex)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertDisabled(); @@ -411,8 +405,7 @@ moduleFor( // this.assertAttr('size', '21'); //NOTE: failing in IE (TEST_SUITE=sauce) // this.assertAttr('tabindex', '31'); //NOTE: failing in IE (TEST_SUITE=sauce) - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { runTask(() => { set(this.context, 'value', 'Original value'); @@ -426,7 +419,8 @@ moduleFor( // set(this.context, 'tabindex', 30); //NOTE: failing in IE (TEST_SUITE=sauce) }); }, - /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|minlength|size|tabindex)` argument to is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|minlength|size|tabindex)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertNotDisabled(); @@ -481,23 +475,23 @@ moduleFor( } ['@test [DEPRECATED] static attributes (named argument)']() { - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render( `` + @elementId="test-input" + @ariaRole="search" + @disabled={{true}} + @placeholder="Original placeholder" + @name="original-name" + @maxlength={{10}} + @minlength={{5}} + @size={{20}} + @tabindex={{30}}/>` ); }, - /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|minlength|size|tabindex)` argument to is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|minlength|size|tabindex)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertDisabled(); @@ -637,8 +631,7 @@ moduleFor( ['@test sends an action with `` is pressed'](assert) { let triggered = 0; - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render(``, { value: 'initial', @@ -656,7 +649,8 @@ moduleFor( }, }); }, - /Passing the `@key-press` argument to is deprecated\./ + /Passing the `@key-press` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.triggerEvent('keypress', { key: 'A' }); @@ -678,10 +672,10 @@ moduleFor( template: ``, }); - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => this.render(``), - 'Passing the `@bubbles` argument to is deprecated.' + 'Passing the `@bubbles` argument to is deprecated.', + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.triggerEvent('change'); @@ -692,8 +686,7 @@ moduleFor( ['@test [DEPRECATED] triggers `focus-in` when focused'](assert) { let wasFocused = false; - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render(``, { actions: { @@ -703,7 +696,8 @@ moduleFor( }, }); }, - /Passing the `@focus-in` argument to is deprecated\./ + /Passing the `@focus-in` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); runTask(() => { @@ -810,8 +804,7 @@ moduleFor( ) { let triggered = 0; - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render(``, { actions: { @@ -827,7 +820,8 @@ moduleFor( }, }); }, - /Passing the `@key-down` argument to is deprecated\./ + /Passing the `@key-down` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.triggerEvent('keydown', { key: 'A' }); @@ -865,8 +859,7 @@ moduleFor( ) { let triggered = 0; - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render(``, { actions: { @@ -882,7 +875,8 @@ moduleFor( }, }); }, - /Passing the `@key-up` argument to is deprecated\./ + /Passing the `@key-up` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.triggerEvent('keyup', { key: 'A' }); @@ -902,8 +896,7 @@ moduleFor( } ['@test [DEPRECATED] triggers a method with ``'](assert) { - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render(``, { didTrigger: action(function () { @@ -911,7 +904,8 @@ moduleFor( }), }); }, - /Passing the `@key-up` argument to is deprecated\./ + /Passing the `@key-up` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.triggerEvent('keyup', { key: 'A' }); @@ -1045,8 +1039,7 @@ moduleFor( } ['@test [DEPRECATED] dynamic attributes (named argument)']() { - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render( ` is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|name|tabindex)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertSingleCheckbox(); @@ -1081,8 +1075,7 @@ moduleFor( this.assertAttr('name', 'original-name'); this.assertAttr('tabindex', '10'); - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { runTask(() => { set(this.context, 'role', 'radio'); @@ -1091,7 +1084,8 @@ moduleFor( set(this.context, 'tabindex', 11); }); }, - /Passing the `@(elementId|ariaRole|disabled|name|tabindex)` argument to is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|name|tabindex)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertSingleCheckbox(); @@ -1100,8 +1094,7 @@ moduleFor( this.assertAttr('name', 'updated-name'); this.assertAttr('tabindex', '11'); - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { runTask(() => { set(this.context, 'role', 'checkbox'); @@ -1110,7 +1103,8 @@ moduleFor( set(this.context, 'tabindex', 10); }); }, - /Passing the `@(elementId|ariaRole|disabled|name|tabindex)` argument to is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|name|tabindex)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertSingleCheckbox(); @@ -1204,14 +1198,14 @@ moduleFor( } ['@test [DEPRECATED] with static values (named argument)']() { - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render( `` ); }, - /Passing the `@(elementId|ariaRole|disabled|tabindex|name)` argument to is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|tabindex|name)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertSingleCheckbox(); @@ -1318,8 +1312,7 @@ moduleFor( ['@test [DEPRECATED] null values (named argument)']() { let attributes = ['role', 'disabled', 'placeholder', 'name', 'maxlength', 'size', 'tabindex']; - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render( ` is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|size|tabindex)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertValue(''); @@ -1353,8 +1347,7 @@ moduleFor( this.assertValue(''); this.assertAllAttrs(attributes, undefined); - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { runTask(() => { set(this.context, 'role', 'search'); @@ -1367,7 +1360,8 @@ moduleFor( set(this.context, 'tabindex', 31); }); }, - /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|size|tabindex)` argument to is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|size|tabindex)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertDisabled(); @@ -1379,8 +1373,7 @@ moduleFor( this.assertAttr('size', '21'); this.assertAttr('tabindex', '31'); - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { runTask(() => { set(this.context, 'role', null); @@ -1393,7 +1386,8 @@ moduleFor( set(this.context, 'tabindex', null); }); }, - /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|size|tabindex)` argument to is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|size|tabindex)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertAttr('disabled', undefined); @@ -1468,10 +1462,10 @@ function InputAttributesTest(attrs) { `[GH#15675] Components test: `, class extends InputAttributesTest(attrs) { renderInput(value = 25) { - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => super.renderInput(value), - /Passing the `@(min|max)` argument to is deprecated\./ + /Passing the `@(min|max)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); } } diff --git a/packages/@ember/-internals/glimmer/tests/integration/components/input-curly-test.js b/packages/@ember/-internals/glimmer/tests/integration/components/input-curly-test.js index 8533d2d2da2..63ca4a10d20 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/components/input-curly-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/components/input-curly-test.js @@ -1,7 +1,6 @@ import { RenderingTestCase, moduleFor, runDestroy, runTask } from 'internal-test-helpers'; import { EMBER_MODERNIZED_BUILT_IN_COMPONENTS } from '@ember/canary-features'; -import { maybeExpectDeprecation } from 'internal-test-helpers'; import { action } from '@ember/object'; import { assign } from '@ember/polyfills'; import { set } from '@ember/-internals/metal'; @@ -125,12 +124,12 @@ class InputRenderingTest extends RenderingTestCase { .join(' '); let template = `{{test-component ${typeAttr}${actionAttrs}}}{{input ${typeAttr}${actionAttrs}}}`; - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render(template, { actions }); }, - /Passing the `@(touchStart|touchMove|touchEnd|touchCancel|keyDown|keyUp|keyPress|mouseDown|mouseUp|contextMenu|click|doubleClick|focusIn|focusOut|submit|input|change|dragStart|drag|dragEnter|dragLeave|dragOver|drop|dragEnd|mouseEnter|mouseLeave|mouseMove|focus-in|focus-out|key-press|key-up|key-down)` argument to is deprecated\./ + /Passing the `@(touchStart|touchMove|touchEnd|touchCancel|keyDown|keyUp|keyPress|mouseDown|mouseUp|contextMenu|click|doubleClick|focusIn|focusOut|submit|input|change|dragStart|drag|dragEnter|dragLeave|dragOver|drop|dragEnd|mouseEnter|mouseLeave|mouseMove|focus-in|focus-out|key-press|key-up|key-down)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); Object.keys(events).forEach((evt) => this.triggerEvent(evt, null, 'input:first-of-type')); @@ -189,8 +188,7 @@ moduleFor( } ['@test [DEPRECATED] dynamic attributes']() { - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render( ` @@ -219,7 +217,8 @@ moduleFor( } ); }, - /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|minlength|size|tabindex)` argument to is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|minlength|size|tabindex)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertNotDisabled(); @@ -246,8 +245,7 @@ moduleFor( // this.assertAttr('size', '20'); //NOTE: failing in IE (TEST_SUITE=sauce) // this.assertAttr('tabindex', '30'); //NOTE: failing in IE (TEST_SUITE=sauce) - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { runTask(() => { set(this.context, 'role', 'search'); @@ -261,7 +259,8 @@ moduleFor( // set(this.context, 'tabindex', 31); //NOTE: failing in IE (TEST_SUITE=sauce) }); }, - /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|minlength|size|tabindex)` argument to is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|minlength|size|tabindex)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertDisabled(); @@ -275,8 +274,7 @@ moduleFor( // this.assertAttr('size', '21'); //NOTE: failing in IE (TEST_SUITE=sauce) // this.assertAttr('tabindex', '31'); //NOTE: failing in IE (TEST_SUITE=sauce) - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { runTask(() => { set(this.context, 'role', 'textbox'); @@ -290,7 +288,8 @@ moduleFor( // set(this.context, 'tabindex', 30); //NOTE: failing in IE (TEST_SUITE=sauce) }); }, - /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|minlength|size|tabindex)` argument to is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|minlength|size|tabindex)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertNotDisabled(); @@ -306,8 +305,7 @@ moduleFor( } ['@test [DEPRECATED] static attributes']() { - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render(` {{input type="text" @@ -323,7 +321,8 @@ moduleFor( tabindex=30 }}`); }, - /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|minlength|size|tabindex)` argument to is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|minlength|size|tabindex)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertDisabled(); @@ -463,8 +462,7 @@ moduleFor( ['@test sends an action with `{{input key-press=(action "foo")}}` is pressed'](assert) { let triggered = 0; - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render(`{{input value=this.value key-press=(action 'foo')}}`, { value: 'initial', @@ -482,7 +480,8 @@ moduleFor( }, }); }, - /Passing the `@key-press` argument to is deprecated\./ + /Passing the `@key-press` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.triggerEvent('keypress', { key: 'A' }); @@ -504,10 +503,10 @@ moduleFor( template: `{{input bubbles=true}}`, }); - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => this.render(`{{x-parent}}`), - 'Passing the `@bubbles` argument to is deprecated.' + 'Passing the `@bubbles` argument to is deprecated.', + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.triggerEvent('change'); @@ -518,8 +517,7 @@ moduleFor( ['@test triggers `focus-in` when focused'](assert) { let wasFocused = false; - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render(`{{input focus-in=(action 'foo')}}`, { actions: { @@ -529,7 +527,8 @@ moduleFor( }, }); }, - /Passing the `@focus-in` argument to is deprecated\./ + /Passing the `@focus-in` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); runTask(() => { @@ -636,8 +635,7 @@ moduleFor( ) { let triggered = 0; - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render(`{{input key-down=(action 'foo')}}`, { actions: { @@ -653,7 +651,8 @@ moduleFor( }, }); }, - /Passing the `@key-down` argument to is deprecated\./ + /Passing the `@key-down` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.triggerEvent('keydown', { key: 'A' }); @@ -687,8 +686,7 @@ moduleFor( } ['@test sends an action with `{{input key-up=(action "foo")}}` when a key is pressed'](assert) { - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render(`{{input key-up=(action 'foo')}}`, { actions: { @@ -703,7 +701,8 @@ moduleFor( }, }); }, - /Passing the `@key-up` argument to is deprecated\./ + /Passing the `@key-up` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.triggerEvent('keyup', { key: 'A' }); @@ -721,8 +720,7 @@ moduleFor( } ['@test triggers a method with `{{input key-up=this.didTrigger}}`'](assert) { - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render(`{{input key-up=this.didTrigger}}`, { didTrigger: action(function () { @@ -730,7 +728,8 @@ moduleFor( }), }); }, - /Passing the `@key-up` argument to is deprecated\./ + /Passing the `@key-up` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.triggerEvent('keyup', { key: 'A' }); @@ -803,8 +802,7 @@ moduleFor( `Components test: {{input type='checkbox'}}`, class extends InputRenderingTest { ['@test [DEPRECATED] dynamic attributes']() { - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render( `{{input @@ -825,7 +823,8 @@ moduleFor( } ); }, - /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|minlength|size|tabindex)` argument to is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|minlength|size|tabindex)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertSingleCheckbox(); @@ -844,8 +843,7 @@ moduleFor( this.assertAttr('name', 'original-name'); this.assertAttr('tabindex', '10'); - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { runTask(() => { set(this.context, 'role', 'radio'); @@ -854,7 +852,8 @@ moduleFor( set(this.context, 'tabindex', 11); }); }, - /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|minlength|size|tabindex)` argument to is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|minlength|size|tabindex)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertSingleCheckbox(); @@ -864,8 +863,7 @@ moduleFor( this.assertAttr('name', 'updated-name'); this.assertAttr('tabindex', '11'); - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { runTask(() => { set(this.context, 'role', 'checkbox'); @@ -874,7 +872,8 @@ moduleFor( set(this.context, 'tabindex', 10); }); }, - /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|minlength|size|tabindex)` argument to is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|minlength|size|tabindex)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertSingleCheckbox(); @@ -948,8 +947,7 @@ moduleFor( } ['@test [DEPRECATED] with static values']() { - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render( `{{input type="checkbox" @@ -961,7 +959,8 @@ moduleFor( checked=false}}` ); }, - /Passing the `@(elementId|ariaRole|disabled|tabindex|name)` argument to is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|tabindex|name)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertSingleCheckbox(); @@ -995,8 +994,7 @@ moduleFor( ['@test [DEPRECATED] null values']() { let attributes = ['role', 'disabled', 'placeholder', 'name', 'maxlength', 'size', 'tabindex']; - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { this.render( `{{input type="text" @@ -1021,7 +1019,8 @@ moduleFor( } ); }, - /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|size|tabindex)` argument to is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|size|tabindex)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertValue(''); @@ -1034,8 +1033,7 @@ moduleFor( this.assertAttr('id', 'test-input'); this.assertAllAttrs(attributes, undefined); - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { runTask(() => { set(this.context, 'role', 'search'); @@ -1048,7 +1046,8 @@ moduleFor( set(this.context, 'tabindex', 31); }); }, - /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|size|tabindex)` argument to is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|size|tabindex)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertDisabled(); @@ -1061,8 +1060,7 @@ moduleFor( this.assertAttr('size', '21'); this.assertAttr('tabindex', '31'); - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => { runTask(() => { set(this.context, 'role', null); @@ -1075,7 +1073,8 @@ moduleFor( set(this.context, 'tabindex', null); }); }, - /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|size|tabindex)` argument to is deprecated\./ + /Passing the `@(elementId|ariaRole|disabled|placeholder|name|maxlength|size|tabindex)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); this.assertAttr('disabled', undefined); @@ -1105,10 +1104,10 @@ moduleFor( `[GH#15675] Components test [DEPRECATED]: {{input ${attrs}}}`, class extends InputRenderingTest { renderInput(value = 25) { - maybeExpectDeprecation( - EMBER_MODERNIZED_BUILT_IN_COMPONENTS, + expectDeprecation( () => this.render(`{{input ${attrs.replace('%x', value)}}}`), - /Passing the `@(min|max)` argument to is deprecated\./ + /Passing the `@(min|max)` argument to is deprecated\./, + EMBER_MODERNIZED_BUILT_IN_COMPONENTS ); } diff --git a/packages/@ember/-internals/glimmer/tests/integration/components/textarea-angle-test.js b/packages/@ember/-internals/glimmer/tests/integration/components/textarea-angle-test.js index fa8e713cd07..2d728f7190f 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/components/textarea-angle-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/components/textarea-angle-test.js @@ -1,11 +1,4 @@ -import { - RenderingTestCase, - maybeExpectDeprecation, - moduleFor, - classes, - applyMixins, - runTask, -} from 'internal-test-helpers'; +import { RenderingTestCase, moduleFor, classes, applyMixins, runTask } from 'internal-test-helpers'; import { EMBER_MODERNIZED_BUILT_IN_COMPONENTS } from '@ember/canary-features'; import { action } from '@ember/object'; @@ -61,26 +54,26 @@ class BoundTextAreaAttributes { `Passing the \`@${argument}\` argument to