language
stringclasses 1
value | owner
stringlengths 2
15
| repo
stringlengths 2
21
| sha
stringlengths 45
45
| message
stringlengths 7
36.3k
| path
stringlengths 1
199
| patch
stringlengths 15
102k
| is_multipart
bool 2
classes |
---|---|---|---|---|---|---|---|
Other
|
emberjs
|
ember.js
|
3e4d3878c89ef2bf90a60ee289419fe97f5fd791.json
|
Remove internal jQuery usage
|
packages/@ember/-internals/views/index.d.ts
|
@@ -2,8 +2,6 @@ import { Option } from '@glimmer/interfaces';
import { SimpleElement } from '@simple-dom/interface';
import { Object as EmberObject } from '@ember/-internals/runtime';
-export { jQuery, jQueryDisabled } from './lib/system/jquery';
-
export const ActionSupport: any;
export const ChildViewsSupport: any;
export const ClassNamesSupport: any;
| true |
Other
|
emberjs
|
ember.js
|
3e4d3878c89ef2bf90a60ee289419fe97f5fd791.json
|
Remove internal jQuery usage
|
packages/@ember/-internals/views/index.js
|
@@ -1,4 +1,3 @@
-export { jQuery, jQueryDisabled } from './lib/system/jquery';
export {
addChildView,
isSimpleClick,
| true |
Other
|
emberjs
|
ember.js
|
3e4d3878c89ef2bf90a60ee289419fe97f5fd791.json
|
Remove internal jQuery usage
|
packages/@ember/-internals/views/lib/system/jquery.d.ts
|
@@ -1,2 +0,0 @@
-export let jQuery: any;
-export let jQueryDisabled: boolean;
| true |
Other
|
emberjs
|
ember.js
|
3e4d3878c89ef2bf90a60ee289419fe97f5fd791.json
|
Remove internal jQuery usage
|
packages/@ember/-internals/views/lib/system/jquery.js
|
@@ -1,29 +0,0 @@
-import { context } from '@ember/-internals/environment';
-import { hasDOM } from '@ember/-internals/browser-environment';
-import { ENV } from '@ember/-internals/environment';
-import { JQUERY_INTEGRATION } from '@ember/deprecated-features';
-
-export let jQuery;
-export let jQueryDisabled = !JQUERY_INTEGRATION || ENV._JQUERY_INTEGRATION === false;
-
-if (JQUERY_INTEGRATION && hasDOM) {
- jQuery = context.imports.jQuery;
-
- if (!jQueryDisabled && jQuery) {
- if (jQuery.event.addProp) {
- jQuery.event.addProp('dataTransfer');
- } else {
- // http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dndevents
- ['dragstart', 'drag', 'dragenter', 'dragleave', 'dragover', 'drop', 'dragend'].forEach(
- (eventName) => {
- jQuery.event.fixHooks[eventName] = {
- props: ['dataTransfer'],
- };
- }
- );
- }
- } else {
- jQuery = undefined;
- jQueryDisabled = true;
- }
-}
| true |
Other
|
emberjs
|
ember.js
|
3e4d3878c89ef2bf90a60ee289419fe97f5fd791.json
|
Remove internal jQuery usage
|
packages/@ember/application/instance.js
|
@@ -4,7 +4,6 @@
import { get, set, computed } from '@ember/-internals/metal';
import * as environment from '@ember/-internals/browser-environment';
-import { jQuery } from '@ember/-internals/views';
import EngineInstance from '@ember/engine/instance';
import { renderSettled } from '@ember/-internals/glimmer';
@@ -57,8 +56,7 @@ const ApplicationInstance = EngineInstance.extend({
/**
The root DOM element of the Application as an element or a
- [jQuery-compatible selector
- string](http://api.jquery.com/category/selectors/).
+ CSS selector.
@private
@property {String|DOMElement} rootElement
@@ -328,20 +326,6 @@ ApplicationInstance.reopenClass({
*/
class BootOptions {
constructor(options = {}) {
- /**
- Provide a specific instance of jQuery. This is useful in conjunction with
- the `document` option, as it allows you to use a copy of `jQuery` that is
- appropriately bound to the foreign `document` (e.g. a jsdom).
-
- This is highly experimental and support very incomplete at the moment.
-
- @property jQuery
- @type Object
- @default auto-detected
- @private
- */
- this.jQuery = jQuery; // This default is overridable below
-
/**
Interactive mode: whether we need to set up event delegation and invoke
lifecycle callbacks on Components.
@@ -392,7 +376,6 @@ class BootOptions {
}
if (!this.isBrowser) {
- this.jQuery = null;
this.isInteractive = false;
this.location = 'none';
}
@@ -416,7 +399,6 @@ class BootOptions {
}
if (!this.shouldRender) {
- this.jQuery = null;
this.isInteractive = false;
}
@@ -486,10 +468,6 @@ class BootOptions {
this.location = options.location;
}
- if (options.jQuery !== undefined) {
- this.jQuery = options.jQuery;
- }
-
if (options.isInteractive !== undefined) {
this.isInteractive = Boolean(options.isInteractive);
}
| true |
Other
|
emberjs
|
ember.js
|
3e4d3878c89ef2bf90a60ee289419fe97f5fd791.json
|
Remove internal jQuery usage
|
packages/@ember/application/lib/application.js
|
@@ -11,7 +11,7 @@ import { join, once, run, schedule } from '@ember/runloop';
import { libraries } from '@ember/-internals/metal';
import { _loaded, runLoadHooks } from './lazy_load';
import { RSVP } from '@ember/-internals/runtime';
-import { EventDispatcher, jQuery, jQueryDisabled } from '@ember/-internals/views';
+import { EventDispatcher } from '@ember/-internals/views';
import {
Route,
Router,
@@ -26,9 +26,6 @@ import Engine from '@ember/engine';
import { privatize as P } from '@ember/-internals/container';
import { setupApplicationRegistry } from '@ember/-internals/glimmer';
import { RouterService } from '@ember/-internals/routing';
-import { JQUERY_INTEGRATION } from '@ember/deprecated-features';
-
-let librariesRegistered = false;
/**
An instance of `Application` is the starting point for every Ember
@@ -353,12 +350,6 @@ const Application = Engine.extend({
// eslint-disable-line no-unused-vars
this._super(...arguments);
- if (!this.$) {
- this.$ = jQuery;
- }
-
- registerLibraries();
-
if (DEBUG) {
if (ENV.LOG_VERSION) {
// we only need to see this once per Application#init
@@ -1170,14 +1161,4 @@ function commonSetupRegistry(registry) {
registry.register('service:router', RouterService);
}
-function registerLibraries() {
- if (!librariesRegistered) {
- librariesRegistered = true;
-
- if (JQUERY_INTEGRATION && hasDOM && !jQueryDisabled) {
- libraries.registerCoreLibrary('jQuery', jQuery().jquery);
- }
- }
-}
-
export default Application;
| true |
Other
|
emberjs
|
ember.js
|
3e4d3878c89ef2bf90a60ee289419fe97f5fd791.json
|
Remove internal jQuery usage
|
packages/@ember/application/tests/application_test.js
|
@@ -4,7 +4,6 @@ import { ENV } from '@ember/-internals/environment';
import { libraries } from '@ember/-internals/metal';
import { getDebugFunction, setDebugFunction } from '@ember/debug';
import { Router, NoneLocation, Route as EmberRoute } from '@ember/-internals/routing';
-import { jQueryDisabled, jQuery } from '@ember/-internals/views';
import { _loaded } from '@ember/application';
import Controller from '@ember/controller';
import { Object as EmberObject } from '@ember/-internals/runtime';
@@ -279,12 +278,7 @@ moduleFor(
runTask(() => this.createApplication());
assert.equal(messages[1], 'Ember : ' + VERSION);
- if (jQueryDisabled) {
- assert.equal(messages[2], 'my-lib : ' + '2.0.0a');
- } else {
- assert.equal(messages[2], 'jQuery : ' + jQuery().jquery);
- assert.equal(messages[3], 'my-lib : ' + '2.0.0a');
- }
+ assert.equal(messages[2], 'my-lib : ' + '2.0.0a');
libraries.deRegister('my-lib');
}
| true |
Other
|
emberjs
|
ember.js
|
3e4d3878c89ef2bf90a60ee289419fe97f5fd791.json
|
Remove internal jQuery usage
|
packages/@ember/deprecated-features/index.ts
|
@@ -4,7 +4,6 @@
// not the version that the feature will be removed.
export const ROUTER_EVENTS = !!'4.0.0';
-export const JQUERY_INTEGRATION = !!'3.9.0';
export const APP_CTRL_ROUTER_PROPS = !!'3.10.0-beta.1';
export const MOUSE_ENTER_LEAVE_MOVE_EVENTS = !!'3.13.0-beta.1';
export const ASSIGN = !!'4.0.0-beta.1';
| true |
Other
|
emberjs
|
ember.js
|
3e4d3878c89ef2bf90a60ee289419fe97f5fd791.json
|
Remove internal jQuery usage
|
packages/ember/tests/reexports_test.js
|
@@ -3,7 +3,6 @@ import require from 'require';
import { EMBER_MODERNIZED_BUILT_IN_COMPONENTS, FEATURES } from '@ember/canary-features';
import { AbstractTestCase, confirmExport, moduleFor } from 'internal-test-helpers';
import { DEBUG } from '@glimmer/env';
-import { ENV } from '@ember/-internals/environment';
moduleFor(
'ember reexports',
@@ -443,9 +442,6 @@ let allExports = [
// backburner
['_Backburner', 'backburner', 'default'],
- // jquery
- ENV._JQUERY_INTEGRATION ? [null, 'jquery', 'default'] : null,
-
// rsvp
[null, 'rsvp', 'default'],
[null, 'rsvp', 'Promise'],
| true |
Other
|
emberjs
|
ember.js
|
3e4d3878c89ef2bf90a60ee289419fe97f5fd791.json
|
Remove internal jQuery usage
|
tests/docs/expected.js
|
@@ -11,7 +11,6 @@ module.exports = {
'_APPLICATION_TEMPLATE_WRAPPER',
'_DISABLE_PROPERTY_FALLBACK_DEPRECATION',
'_DEBUG_RENDER_TREE',
- '_JQUERY_INTEGRATION',
'_DEFAULT_ASYNC_OBSERVERS',
'_RERENDER_LOOP_LIMIT',
'_TEMPLATE_ONLY_GLIMMER_COMPONENTS',
@@ -326,7 +325,6 @@ module.exports = {
'isRejected',
'isSettled',
'join',
- 'jQuery',
'keyDown',
'keyPress',
'keyUp',
| true |
Other
|
emberjs
|
ember.js
|
c2b9023fc8ce2b81667cc80d25f73c2c1d084a06.json
|
Remove jQuery usage from ember-testing
As advised by feedback from core team, this removes all jQuery related testing helpers from ember-testing:
* `find`
* `findWithAssert`
* `triggerEvent`
* `keyEvent`
* `click`
* `fillIn`
All remaining helpers remain untouched for future official deprecation.
|
packages/ember-testing/index.js
|
@@ -3,7 +3,6 @@ export { default as Adapter } from './lib/adapters/adapter';
export { default as setupForTesting } from './lib/setup_for_testing';
export { default as QUnitAdapter } from './lib/adapters/qunit';
-import './lib/support'; // to handle various edge cases
import './lib/ext/application';
import './lib/ext/rsvp'; // setup RSVP + run loop integration
import './lib/helpers'; // adds helpers to helpers object in Test
| true |
Other
|
emberjs
|
ember.js
|
c2b9023fc8ce2b81667cc80d25f73c2c1d084a06.json
|
Remove jQuery usage from ember-testing
As advised by feedback from core team, this removes all jQuery related testing helpers from ember-testing:
* `find`
* `findWithAssert`
* `triggerEvent`
* `keyEvent`
* `click`
* `fillIn`
All remaining helpers remain untouched for future official deprecation.
|
packages/ember-testing/lib/events.js
|
@@ -1,135 +0,0 @@
-import { run } from '@ember/runloop';
-import isFormControl from './helpers/-is-form-control';
-
-const DEFAULT_EVENT_OPTIONS = { canBubble: true, cancelable: true };
-const KEYBOARD_EVENT_TYPES = ['keydown', 'keypress', 'keyup'];
-const MOUSE_EVENT_TYPES = [
- 'click',
- 'mousedown',
- 'mouseup',
- 'dblclick',
- 'mouseenter',
- 'mouseleave',
- 'mousemove',
- 'mouseout',
- 'mouseover',
-];
-
-export function focus(el) {
- if (!el) {
- return;
- }
- if (el.isContentEditable || isFormControl(el)) {
- let type = el.getAttribute('type');
- if (type !== 'checkbox' && type !== 'radio' && type !== 'hidden') {
- run(null, function () {
- let browserIsNotFocused = document.hasFocus && !document.hasFocus();
-
- // makes `document.activeElement` be `element`. If the browser is focused, it also fires a focus event
- el.focus();
-
- // Firefox does not trigger the `focusin` event if the window
- // does not have focus. If the document does not have focus then
- // fire `focusin` event as well.
- if (browserIsNotFocused) {
- // if the browser is not focused the previous `el.focus()` didn't fire an event, so we simulate it
- fireEvent(el, 'focus', {
- bubbles: false,
- });
-
- fireEvent(el, 'focusin');
- }
- });
- }
- }
-}
-
-export function fireEvent(element, type, options = {}) {
- if (!element) {
- return;
- }
- let event;
- if (KEYBOARD_EVENT_TYPES.indexOf(type) > -1) {
- event = buildKeyboardEvent(type, options);
- } else if (MOUSE_EVENT_TYPES.indexOf(type) > -1) {
- let rect = element.getBoundingClientRect();
- let x = rect.left + 1;
- let y = rect.top + 1;
- let simulatedCoordinates = {
- screenX: x + 5,
- screenY: y + 95,
- clientX: x,
- clientY: y,
- };
- event = buildMouseEvent(type, Object.assign(simulatedCoordinates, options));
- } else {
- event = buildBasicEvent(type, options);
- }
- element.dispatchEvent(event);
-}
-
-function buildBasicEvent(type, options = {}) {
- let event = document.createEvent('Events');
-
- // Event.bubbles is read only
- let bubbles = options.bubbles !== undefined ? options.bubbles : true;
- let cancelable = options.cancelable !== undefined ? options.cancelable : true;
-
- delete options.bubbles;
- delete options.cancelable;
-
- event.initEvent(type, bubbles, cancelable);
- Object.assign(event, options);
- return event;
-}
-
-function buildMouseEvent(type, options = {}) {
- let event;
- try {
- event = document.createEvent('MouseEvents');
- let eventOpts = Object.assign({}, DEFAULT_EVENT_OPTIONS, options);
- event.initMouseEvent(
- type,
- eventOpts.canBubble,
- eventOpts.cancelable,
- window,
- eventOpts.detail,
- eventOpts.screenX,
- eventOpts.screenY,
- eventOpts.clientX,
- eventOpts.clientY,
- eventOpts.ctrlKey,
- eventOpts.altKey,
- eventOpts.shiftKey,
- eventOpts.metaKey,
- eventOpts.button,
- eventOpts.relatedTarget
- );
- } catch (e) {
- event = buildBasicEvent(type, options);
- }
- return event;
-}
-
-function buildKeyboardEvent(type, options = {}) {
- let event;
- try {
- event = document.createEvent('KeyEvents');
- let eventOpts = Object.assign({}, DEFAULT_EVENT_OPTIONS, options);
- event.initKeyEvent(
- type,
- eventOpts.canBubble,
- eventOpts.cancelable,
- window,
- eventOpts.ctrlKey,
- eventOpts.altKey,
- eventOpts.shiftKey,
- eventOpts.metaKey,
- eventOpts.keyCode,
- eventOpts.charCode
- );
- } catch (e) {
- event = buildBasicEvent(type, options);
- }
- return event;
-}
| true |
Other
|
emberjs
|
ember.js
|
c2b9023fc8ce2b81667cc80d25f73c2c1d084a06.json
|
Remove jQuery usage from ember-testing
As advised by feedback from core team, this removes all jQuery related testing helpers from ember-testing:
* `find`
* `findWithAssert`
* `triggerEvent`
* `keyEvent`
* `click`
* `fillIn`
All remaining helpers remain untouched for future official deprecation.
|
packages/ember-testing/lib/helpers.js
|
@@ -1,29 +1,17 @@
import { registerHelper as helper, registerAsyncHelper as asyncHelper } from './test/helpers';
import andThen from './helpers/and_then';
-import click from './helpers/click';
import currentPath from './helpers/current_path';
import currentRouteName from './helpers/current_route_name';
import currentURL from './helpers/current_url';
-import fillIn from './helpers/fill_in';
-import find from './helpers/find';
-import findWithAssert from './helpers/find_with_assert';
-import keyEvent from './helpers/key_event';
import { pauseTest, resumeTest } from './helpers/pause_test';
-import triggerEvent from './helpers/trigger_event';
import visit from './helpers/visit';
import wait from './helpers/wait';
asyncHelper('visit', visit);
-asyncHelper('click', click);
-asyncHelper('keyEvent', keyEvent);
-asyncHelper('fillIn', fillIn);
asyncHelper('wait', wait);
asyncHelper('andThen', andThen);
asyncHelper('pauseTest', pauseTest);
-asyncHelper('triggerEvent', triggerEvent);
-helper('find', find);
-helper('findWithAssert', findWithAssert);
helper('currentRouteName', currentRouteName);
helper('currentPath', currentPath);
helper('currentURL', currentURL);
| true |
Other
|
emberjs
|
ember.js
|
c2b9023fc8ce2b81667cc80d25f73c2c1d084a06.json
|
Remove jQuery usage from ember-testing
As advised by feedback from core team, this removes all jQuery related testing helpers from ember-testing:
* `find`
* `findWithAssert`
* `triggerEvent`
* `keyEvent`
* `click`
* `fillIn`
All remaining helpers remain untouched for future official deprecation.
|
packages/ember-testing/lib/helpers/-is-form-control.js
|
@@ -1,16 +0,0 @@
-const FORM_CONTROL_TAGS = ['INPUT', 'BUTTON', 'SELECT', 'TEXTAREA'];
-
-/**
- @private
- @param {Element} element the element to check
- @returns {boolean} `true` when the element is a form control, `false` otherwise
-*/
-export default function isFormControl(element) {
- let { tagName, type } = element;
-
- if (type === 'hidden') {
- return false;
- }
-
- return FORM_CONTROL_TAGS.indexOf(tagName) > -1;
-}
| true |
Other
|
emberjs
|
ember.js
|
c2b9023fc8ce2b81667cc80d25f73c2c1d084a06.json
|
Remove jQuery usage from ember-testing
As advised by feedback from core team, this removes all jQuery related testing helpers from ember-testing:
* `find`
* `findWithAssert`
* `triggerEvent`
* `keyEvent`
* `click`
* `fillIn`
All remaining helpers remain untouched for future official deprecation.
|
packages/ember-testing/lib/helpers/click.js
|
@@ -1,36 +0,0 @@
-/**
-@module ember
-*/
-import { focus, fireEvent } from '../events';
-
-/**
- Clicks an element and triggers any actions triggered by the element's `click`
- event.
-
- Example:
-
- ```javascript
- click('.some-jQuery-selector').then(function() {
- // assert something
- });
- ```
-
- @method click
- @param {String} selector jQuery selector for finding element on the DOM
- @param {Object} context A DOM Element, Document, or jQuery to use as context
- @return {RSVP.Promise<undefined>}
- @public
-*/
-export default function click(app, selector, context) {
- let $el = app.testHelpers.findWithAssert(selector, context);
- let el = $el[0];
-
- fireEvent(el, 'mousedown');
-
- focus(el);
-
- fireEvent(el, 'mouseup');
- fireEvent(el, 'click');
-
- return app.testHelpers.wait();
-}
| true |
Other
|
emberjs
|
ember.js
|
c2b9023fc8ce2b81667cc80d25f73c2c1d084a06.json
|
Remove jQuery usage from ember-testing
As advised by feedback from core team, this removes all jQuery related testing helpers from ember-testing:
* `find`
* `findWithAssert`
* `triggerEvent`
* `keyEvent`
* `click`
* `fillIn`
All remaining helpers remain untouched for future official deprecation.
|
packages/ember-testing/lib/helpers/fill_in.js
|
@@ -1,46 +0,0 @@
-/**
-@module ember
-*/
-import { focus, fireEvent } from '../events';
-import isFormControl from './-is-form-control';
-
-/**
- Fills in an input element with some text.
-
- Example:
-
- ```javascript
- fillIn('#email', '[email protected]').then(function() {
- // assert something
- });
- ```
-
- @method fillIn
- @param {String} selector jQuery selector finding an input element on the DOM
- to fill text with
- @param {String} text text to place inside the input element
- @return {RSVP.Promise<undefined>}
- @public
-*/
-export default function fillIn(app, selector, contextOrText, text) {
- let $el, el, context;
- if (text === undefined) {
- text = contextOrText;
- } else {
- context = contextOrText;
- }
- $el = app.testHelpers.findWithAssert(selector, context);
- el = $el[0];
- focus(el);
-
- if (isFormControl(el)) {
- el.value = text;
- } else {
- el.innerHTML = text;
- }
-
- fireEvent(el, 'input');
- fireEvent(el, 'change');
-
- return app.testHelpers.wait();
-}
| true |
Other
|
emberjs
|
ember.js
|
c2b9023fc8ce2b81667cc80d25f73c2c1d084a06.json
|
Remove jQuery usage from ember-testing
As advised by feedback from core team, this removes all jQuery related testing helpers from ember-testing:
* `find`
* `findWithAssert`
* `triggerEvent`
* `keyEvent`
* `click`
* `fillIn`
All remaining helpers remain untouched for future official deprecation.
|
packages/ember-testing/lib/helpers/find.js
|
@@ -1,41 +0,0 @@
-/**
-@module ember
-*/
-import { get } from '@ember/-internals/metal';
-import { assert } from '@ember/debug';
-import { jQueryDisabled } from '@ember/-internals/views';
-
-/**
- Finds an element in the context of the app's container element. A simple alias
- for `app.$(selector)`.
-
- Example:
-
- ```javascript
- var $el = find('.my-selector');
- ```
-
- With the `context` param:
-
- ```javascript
- var $el = find('.my-selector', '.parent-element-class');
- ```
-
- @method find
- @param {String} selector jQuery selector for element lookup
- @param {String} [context] (optional) jQuery selector that will limit the selector
- argument to find only within the context's children
- @return {Object} DOM element representing the results of the query
- @public
-*/
-export default function find(app, selector, context) {
- if (jQueryDisabled) {
- assert(
- 'If jQuery is disabled, please import and use helpers from @ember/test-helpers [https://github.com/emberjs/ember-test-helpers]. Note: `find` is not an available helper.'
- );
- }
- let $el;
- context = context || get(app, 'rootElement');
- $el = app.$(selector, context);
- return $el;
-}
| true |
Other
|
emberjs
|
ember.js
|
c2b9023fc8ce2b81667cc80d25f73c2c1d084a06.json
|
Remove jQuery usage from ember-testing
As advised by feedback from core team, this removes all jQuery related testing helpers from ember-testing:
* `find`
* `findWithAssert`
* `triggerEvent`
* `keyEvent`
* `click`
* `fillIn`
All remaining helpers remain untouched for future official deprecation.
|
packages/ember-testing/lib/helpers/find_with_assert.js
|
@@ -1,34 +0,0 @@
-/**
-@module ember
-*/
-/**
- Like `find`, but throws an error if the element selector returns no results.
-
- Example:
-
- ```javascript
- var $el = findWithAssert('.doesnt-exist'); // throws error
- ```
-
- With the `context` param:
-
- ```javascript
- var $el = findWithAssert('.selector-id', '.parent-element-class'); // assert will pass
- ```
-
- @method findWithAssert
- @param {String} selector jQuery selector string for finding an element within
- the DOM
- @param {String} [context] (optional) jQuery selector that will limit the
- selector argument to find only within the context's children
- @return {Object} jQuery object representing the results of the query
- @throws {Error} throws error if object returned has a length of 0
- @public
-*/
-export default function findWithAssert(app, selector, context) {
- let $el = app.testHelpers.find(selector, context);
- if ($el.length === 0) {
- throw new Error('Element ' + selector + ' not found.');
- }
- return $el;
-}
| true |
Other
|
emberjs
|
ember.js
|
c2b9023fc8ce2b81667cc80d25f73c2c1d084a06.json
|
Remove jQuery usage from ember-testing
As advised by feedback from core team, this removes all jQuery related testing helpers from ember-testing:
* `find`
* `findWithAssert`
* `triggerEvent`
* `keyEvent`
* `click`
* `fillIn`
All remaining helpers remain untouched for future official deprecation.
|
packages/ember-testing/lib/helpers/key_event.js
|
@@ -1,36 +0,0 @@
-/**
-@module ember
-*/
-/**
- Simulates a key event, e.g. `keypress`, `keydown`, `keyup` with the desired keyCode
- Example:
- ```javascript
- keyEvent('.some-jQuery-selector', 'keypress', 13).then(function() {
- // assert something
- });
- ```
- @method keyEvent
- @param {String} selector jQuery selector for finding element on the DOM
- @param {String} type the type of key event, e.g. `keypress`, `keydown`, `keyup`
- @param {Number} keyCode the keyCode of the simulated key event
- @return {RSVP.Promise<undefined>}
- @since 1.5.0
- @public
-*/
-export default function keyEvent(app, selector, contextOrType, typeOrKeyCode, keyCode) {
- let context, type;
-
- if (keyCode === undefined) {
- context = null;
- keyCode = typeOrKeyCode;
- type = contextOrType;
- } else {
- context = contextOrType;
- type = typeOrKeyCode;
- }
-
- return app.testHelpers.triggerEvent(selector, context, type, {
- keyCode,
- which: keyCode,
- });
-}
| true |
Other
|
emberjs
|
ember.js
|
c2b9023fc8ce2b81667cc80d25f73c2c1d084a06.json
|
Remove jQuery usage from ember-testing
As advised by feedback from core team, this removes all jQuery related testing helpers from ember-testing:
* `find`
* `findWithAssert`
* `triggerEvent`
* `keyEvent`
* `click`
* `fillIn`
All remaining helpers remain untouched for future official deprecation.
|
packages/ember-testing/lib/helpers/trigger_event.js
|
@@ -1,62 +0,0 @@
-/**
-@module ember
-*/
-import { fireEvent } from '../events';
-/**
- Triggers the given DOM event on the element identified by the provided selector.
- Example:
- ```javascript
- triggerEvent('#some-elem-id', 'blur');
- ```
- This is actually used internally by the `keyEvent` helper like so:
- ```javascript
- triggerEvent('#some-elem-id', 'keypress', { keyCode: 13 });
- ```
- @method triggerEvent
- @param {String} selector jQuery selector for finding element on the DOM
- @param {String} [context] jQuery selector that will limit the selector
- argument to find only within the context's children
- @param {String} type The event type to be triggered.
- @param {Object} [options] The options to be passed to jQuery.Event.
- @return {RSVP.Promise<undefined>}
- @since 1.5.0
- @public
-*/
-export default function triggerEvent(app, selector, contextOrType, typeOrOptions, possibleOptions) {
- let arity = arguments.length;
- let context, type, options;
-
- if (arity === 3) {
- // context and options are optional, so this is
- // app, selector, type
- context = null;
- type = contextOrType;
- options = {};
- } else if (arity === 4) {
- // context and options are optional, so this is
- if (typeof typeOrOptions === 'object') {
- // either
- // app, selector, type, options
- context = null;
- type = contextOrType;
- options = typeOrOptions;
- } else {
- // or
- // app, selector, context, type
- context = contextOrType;
- type = typeOrOptions;
- options = {};
- }
- } else {
- context = contextOrType;
- type = typeOrOptions;
- options = possibleOptions;
- }
-
- let $el = app.testHelpers.findWithAssert(selector, context);
- let el = $el[0];
-
- fireEvent(el, type, options);
-
- return app.testHelpers.wait();
-}
| true |
Other
|
emberjs
|
ember.js
|
c2b9023fc8ce2b81667cc80d25f73c2c1d084a06.json
|
Remove jQuery usage from ember-testing
As advised by feedback from core team, this removes all jQuery related testing helpers from ember-testing:
* `find`
* `findWithAssert`
* `triggerEvent`
* `keyEvent`
* `click`
* `fillIn`
All remaining helpers remain untouched for future official deprecation.
|
packages/ember-testing/lib/setup_for_testing.js
|
@@ -1,13 +1,7 @@
/* global self */
import { setTesting } from '@ember/debug';
-import { jQuery, jQueryDisabled } from '@ember/-internals/views';
import { getAdapter, setAdapter } from './test/adapter';
-import {
- incrementPendingRequests,
- decrementPendingRequests,
- clearPendingRequests,
-} from './test/pending_requests';
import Adapter from './adapters/adapter';
import QUnitAdapter from './adapters/qunit';
@@ -31,14 +25,4 @@ export default function setupForTesting() {
if (!adapter) {
setAdapter(typeof self.QUnit === 'undefined' ? Adapter.create() : QUnitAdapter.create());
}
-
- if (!jQueryDisabled) {
- jQuery(document).off('ajaxSend', incrementPendingRequests);
- jQuery(document).off('ajaxComplete', decrementPendingRequests);
-
- clearPendingRequests();
-
- jQuery(document).on('ajaxSend', incrementPendingRequests);
- jQuery(document).on('ajaxComplete', decrementPendingRequests);
- }
}
| true |
Other
|
emberjs
|
ember.js
|
c2b9023fc8ce2b81667cc80d25f73c2c1d084a06.json
|
Remove jQuery usage from ember-testing
As advised by feedback from core team, this removes all jQuery related testing helpers from ember-testing:
* `find`
* `findWithAssert`
* `triggerEvent`
* `keyEvent`
* `click`
* `fillIn`
All remaining helpers remain untouched for future official deprecation.
|
packages/ember-testing/lib/support.js
|
@@ -1,62 +0,0 @@
-import { warn } from '@ember/debug';
-import { jQuery, jQueryDisabled } from '@ember/-internals/views';
-
-import { hasDOM } from '@ember/-internals/browser-environment';
-
-/**
- @module ember
-*/
-
-const $ = jQuery;
-
-/**
- This method creates a checkbox and triggers the click event to fire the
- passed in handler. It is used to correct for a bug in older versions
- of jQuery (e.g 1.8.3).
-
- @private
- @method testCheckboxClick
-*/
-function testCheckboxClick(handler) {
- let input = document.createElement('input');
- $(input)
- .attr('type', 'checkbox')
- .css({ position: 'absolute', left: '-1000px', top: '-1000px' })
- .appendTo('body')
- .on('click', handler)
- .trigger('click')
- .remove();
-}
-
-if (hasDOM && !jQueryDisabled) {
- $(function () {
- /*
- Determine whether a checkbox checked using jQuery's "click" method will have
- the correct value for its checked property.
-
- If we determine that the current jQuery version exhibits this behavior,
- patch it to work correctly as in the commit for the actual fix:
- https://github.com/jquery/jquery/commit/1fb2f92.
- */
- testCheckboxClick(function () {
- if (!this.checked && !$.event.special.click) {
- $.event.special.click = {
- // For checkbox, fire native event so checked state will be right
- trigger() {
- if (this.nodeName === 'INPUT' && this.type === 'checkbox' && this.click) {
- this.click();
- return false;
- }
- },
- };
- }
- });
-
- // Try again to verify that the patch took effect or blow up.
- testCheckboxClick(function () {
- warn("clicked checkboxes should be checked! the jQuery patch didn't work", this.checked, {
- id: 'ember-testing.test-checkbox-click',
- });
- });
- });
-}
| true |
Other
|
emberjs
|
ember.js
|
c2b9023fc8ce2b81667cc80d25f73c2c1d084a06.json
|
Remove jQuery usage from ember-testing
As advised by feedback from core team, this removes all jQuery related testing helpers from ember-testing:
* `find`
* `findWithAssert`
* `triggerEvent`
* `keyEvent`
* `click`
* `fillIn`
All remaining helpers remain untouched for future official deprecation.
|
packages/ember-testing/tests/acceptance_test.js
|
@@ -1,480 +0,0 @@
-import { moduleFor, AutobootApplicationTestCase, runTask } from 'internal-test-helpers';
-
-import { later } from '@ember/runloop';
-import Test from '../lib/test';
-import QUnitAdapter from '../lib/adapters/qunit';
-import { Route } from '@ember/-internals/routing';
-import { RSVP } from '@ember/-internals/runtime';
-import { jQueryDisabled } from '@ember/-internals/views';
-import { getDebugFunction, setDebugFunction } from '@ember/debug';
-
-const originalDebug = getDebugFunction('debug');
-
-const originalConsoleError = console.error; // eslint-disable-line no-console
-let testContext;
-
-if (!jQueryDisabled) {
- moduleFor(
- 'ember-testing Acceptance',
- class extends AutobootApplicationTestCase {
- constructor() {
- setDebugFunction('debug', function () {});
- super();
- this._originalAdapter = Test.adapter;
-
- testContext = this;
-
- runTask(() => {
- this.createApplication();
- this.router.map(function () {
- this.route('posts');
- this.route('comments');
-
- this.route('abort_transition');
-
- this.route('redirect');
- });
-
- this.indexHitCount = 0;
- this.currentRoute = 'index';
-
- this.add(
- 'route:index',
- Route.extend({
- model() {
- testContext.indexHitCount += 1;
- },
- })
- );
-
- this.add(
- 'route:posts',
- Route.extend({
- setupController() {
- testContext.currentRoute = 'posts';
- this._super(...arguments);
- },
- })
- );
-
- this.addTemplate(
- 'posts',
- `
- <div class="posts-view">
- <a class="dummy-link"></a>
- <div id="comments-link">
- {{#link-to route='comments'}}Comments{{/link-to}}
- </div>
- </div>
- `
- );
-
- this.add(
- 'route:comments',
- Route.extend({
- setupController() {
- testContext.currentRoute = 'comments';
- this._super(...arguments);
- },
- })
- );
-
- this.addTemplate('comments', `<div>{{input type="text"}}</div>`);
-
- this.add(
- 'route:abort_transition',
- Route.extend({
- beforeModel(transition) {
- transition.abort();
- },
- })
- );
-
- this.add(
- 'route:redirect',
- Route.extend({
- beforeModel() {
- expectDeprecation(() => {
- this.transitionTo('comments');
- }, /Calling transitionTo on a route is deprecated/);
- },
- })
- );
-
- this.application.setupForTesting();
-
- Test.registerAsyncHelper('slowHelper', () => {
- return new RSVP.Promise((resolve) => later(resolve, 10));
- });
-
- this.application.injectTestHelpers();
- });
- }
- afterEach() {
- console.error = originalConsoleError; // eslint-disable-line no-console
- super.afterEach();
- }
-
- teardown() {
- setDebugFunction('debug', originalDebug);
- Test.adapter = this._originalAdapter;
- Test.unregisterHelper('slowHelper');
- window.slowHelper = undefined;
- testContext = undefined;
- super.teardown();
- }
-
- [`@test helpers can be chained with then`](assert) {
- assert.expect(6);
-
- window
- .visit('/posts')
- .then(() => {
- assert.equal(this.currentRoute, 'posts', 'Successfully visited posts route');
- assert.equal(window.currentURL(), '/posts', 'posts URL is correct');
- return window.click('a:contains("Comments")');
- })
- .then(() => {
- assert.equal(this.currentRoute, 'comments', 'visit chained with click');
- return window.fillIn('.ember-text-field', 'yeah');
- })
- .then(() => {
- assert.equal(
- document.querySelector('.ember-text-field').value,
- 'yeah',
- 'chained with fillIn'
- );
- return window.fillIn('.ember-text-field', '#qunit-fixture', 'context working');
- })
- .then(() => {
- assert.equal(
- document.querySelector('.ember-text-field').value,
- 'context working',
- 'chained with fillIn'
- );
- return window.click('.does-not-exist');
- })
- .catch((e) => {
- assert.equal(
- e.message,
- 'Element .does-not-exist not found.',
- 'Non-existent click exception caught'
- );
- });
- }
-
- [`@test helpers can be chained to each other (legacy)`](assert) {
- assert.expect(7);
-
- window
- .visit('/posts')
- .click('a:first', '#comments-link')
- .fillIn('.ember-text-field', 'hello')
- .then(() => {
- assert.equal(this.currentRoute, 'comments', 'Successfully visited comments route');
- assert.equal(window.currentURL(), '/comments', 'Comments URL is correct');
- assert.equal(
- document.querySelector('.ember-text-field').value,
- 'hello',
- 'Fillin successfully works'
- );
- window.find('.ember-text-field').one('keypress', (e) => {
- assert.equal(e.keyCode, 13, 'keyevent chained with correct keyCode.');
- assert.equal(e.which, 13, 'keyevent chained with correct which.');
- });
- })
- .keyEvent('.ember-text-field', 'keypress', 13)
- .visit('/posts')
- .then(() => {
- assert.equal(this.currentRoute, 'posts', 'Thens can also be chained to helpers');
- assert.equal(window.currentURL(), '/posts', 'URL is set correct on chained helpers');
- });
- }
-
- [`@test helpers don't need to be chained`](assert) {
- assert.expect(5);
-
- window.visit('/posts');
-
- window.click('a:first', '#comments-link');
-
- window.fillIn('.ember-text-field', 'hello');
-
- window.andThen(() => {
- assert.equal(this.currentRoute, 'comments', 'Successfully visited comments route');
- assert.equal(window.currentURL(), '/comments', 'Comments URL is correct');
- assert.equal(
- window.find('.ember-text-field').val(),
- 'hello',
- 'Fillin successfully works'
- );
- });
-
- window.visit('/posts');
-
- window.andThen(() => {
- assert.equal(this.currentRoute, 'posts');
- assert.equal(window.currentURL(), '/posts');
- });
- }
-
- [`@test Nested async helpers`](assert) {
- assert.expect(5);
-
- window.visit('/posts');
-
- window.andThen(() => {
- window.click('a:first', '#comments-link');
- window.fillIn('.ember-text-field', 'hello');
- });
-
- window.andThen(() => {
- assert.equal(this.currentRoute, 'comments', 'Successfully visited comments route');
- assert.equal(window.currentURL(), '/comments', 'Comments URL is correct');
- assert.equal(
- window.find('.ember-text-field').val(),
- 'hello',
- 'Fillin successfully works'
- );
- });
-
- window.visit('/posts');
-
- window.andThen(() => {
- assert.equal(this.currentRoute, 'posts');
- assert.equal(window.currentURL(), '/posts');
- });
- }
-
- [`@test Multiple nested async helpers`](assert) {
- assert.expect(3);
-
- window.visit('/posts');
-
- window.andThen(() => {
- window.click('a:first', '#comments-link');
-
- window.fillIn('.ember-text-field', 'hello');
- window.fillIn('.ember-text-field', 'goodbye');
- });
-
- window.andThen(() => {
- assert.equal(
- window.find('.ember-text-field').val(),
- 'goodbye',
- 'Fillin successfully works'
- );
- assert.equal(this.currentRoute, 'comments', 'Successfully visited comments route');
- assert.equal(window.currentURL(), '/comments', 'Comments URL is correct');
- });
- }
-
- [`@test Helpers nested in thens`](assert) {
- assert.expect(5);
-
- window.visit('/posts').then(() => {
- window.click('a:first', '#comments-link');
- });
-
- window.andThen(() => {
- window.fillIn('.ember-text-field', 'hello');
- });
-
- window.andThen(() => {
- assert.equal(this.currentRoute, 'comments', 'Successfully visited comments route');
- assert.equal(window.currentURL(), '/comments', 'Comments URL is correct');
- assert.equal(
- window.find('.ember-text-field').val(),
- 'hello',
- 'Fillin successfully works'
- );
- });
-
- window.visit('/posts');
-
- window.andThen(() => {
- assert.equal(this.currentRoute, 'posts');
- assert.equal(window.currentURL(), '/posts', 'Posts URL is correct');
- });
- }
-
- [`@test Aborted transitions are not logged via Ember.Test.adapter#exception`](assert) {
- assert.expect(0);
-
- Test.adapter = QUnitAdapter.create({
- exception() {
- assert.ok(false, 'aborted transitions are not logged');
- },
- });
-
- window.visit('/abort_transition');
- }
-
- [`@test Unhandled exceptions are logged via Ember.Test.adapter#exception`](assert) {
- assert.expect(2);
-
- console.error = () => {}; // eslint-disable-line no-console
- let asyncHandled;
- Test.adapter = QUnitAdapter.create({
- exception(error) {
- assert.equal(
- error.message,
- 'Element .does-not-exist not found.',
- 'Exception successfully caught and passed to Ember.Test.adapter.exception'
- );
- // handle the rejection so it doesn't leak later.
- asyncHandled.catch(() => {});
- },
- });
-
- window.visit('/posts');
-
- window.click('.invalid-element').catch((error) => {
- assert.equal(
- error.message,
- 'Element .invalid-element not found.',
- 'Exception successfully handled in the rejection handler'
- );
- });
-
- asyncHandled = window.click('.does-not-exist');
- }
-
- [`@test Unhandled exceptions in 'andThen' are logged via Ember.Test.adapter#exception`](
- assert
- ) {
- assert.expect(1);
-
- console.error = () => {}; // eslint-disable-line no-console
- Test.adapter = QUnitAdapter.create({
- exception(error) {
- assert.equal(
- error.message,
- 'Catch me',
- 'Exception successfully caught and passed to Ember.Test.adapter.exception'
- );
- },
- });
-
- window.visit('/posts');
-
- window.andThen(() => {
- throw new Error('Catch me');
- });
- }
-
- [`@test should not start routing on the root URL when visiting another`](assert) {
- assert.expect(4);
-
- window.visit('/posts');
-
- window.andThen(() => {
- assert.ok(window.find('#comments-link'), 'found comments-link');
- assert.equal(this.currentRoute, 'posts', 'Successfully visited posts route');
- assert.equal(window.currentURL(), '/posts', 'Posts URL is correct');
- assert.equal(
- this.indexHitCount,
- 0,
- 'should not hit index route when visiting another route'
- );
- });
- }
-
- [`@test only enters the index route once when visiting `](assert) {
- assert.expect(1);
-
- window.visit('/');
-
- window.andThen(() => {
- assert.equal(this.indexHitCount, 1, 'should hit index once when visiting /');
- });
- }
-
- [`@test test must not finish while asyncHelpers are pending`](assert) {
- assert.expect(2);
-
- let async = 0;
- let innerRan = false;
-
- Test.adapter = QUnitAdapter.extend({
- asyncStart() {
- async++;
- this._super();
- },
- asyncEnd() {
- async--;
- this._super();
- },
- }).create();
-
- this.application.testHelpers.slowHelper();
-
- window.andThen(() => {
- innerRan = true;
- });
-
- assert.equal(innerRan, false, 'should not have run yet');
- assert.ok(async > 0, 'should have told the adapter to pause');
-
- if (async === 0) {
- // If we failed the test, prevent zalgo from escaping and breaking
- // our other tests.
- Test.adapter.asyncStart();
- Test.resolve().then(() => {
- Test.adapter.asyncEnd();
- });
- }
- }
-
- [`@test visiting a URL that causes another transition should yield the correct URL`](assert) {
- assert.expect(2);
-
- window.visit('/redirect');
-
- window.andThen(() => {
- assert.equal(window.currentURL(), '/comments', 'Redirected to Comments URL');
- });
- }
-
- [`@test visiting a URL and then visiting a second URL with a transition should yield the correct URL`](
- assert
- ) {
- assert.expect(3);
-
- window.visit('/posts');
-
- window.andThen(function () {
- assert.equal(window.currentURL(), '/posts', 'First visited URL is correct');
- });
-
- window.visit('/redirect');
-
- window.andThen(() => {
- assert.equal(window.currentURL(), '/comments', 'Redirected to Comments URL');
- });
- }
- }
- );
-
- moduleFor(
- 'ember-testing Acceptance - teardown',
- class extends AutobootApplicationTestCase {
- [`@test that the setup/teardown happens correctly`](assert) {
- assert.expect(2);
-
- runTask(() => {
- this.createApplication();
- });
- this.application.injectTestHelpers();
-
- assert.ok(typeof Test.Promise.prototype.click === 'function');
-
- runTask(() => {
- this.application.destroy();
- });
-
- assert.equal(Test.Promise.prototype.click, undefined);
- }
- }
- );
-}
| true |
Other
|
emberjs
|
ember.js
|
c2b9023fc8ce2b81667cc80d25f73c2c1d084a06.json
|
Remove jQuery usage from ember-testing
As advised by feedback from core team, this removes all jQuery related testing helpers from ember-testing:
* `find`
* `findWithAssert`
* `triggerEvent`
* `keyEvent`
* `click`
* `fillIn`
All remaining helpers remain untouched for future official deprecation.
|
packages/ember-testing/tests/helpers_test.js
|
@@ -1,1278 +0,0 @@
-import { moduleFor, AutobootApplicationTestCase, runTask } from 'internal-test-helpers';
-
-import { Route } from '@ember/-internals/routing';
-import Controller from '@ember/controller';
-import { RSVP } from '@ember/-internals/runtime';
-import { action } from '@ember/object';
-import { later } from '@ember/runloop';
-import { Component } from '@ember/-internals/glimmer';
-import { jQueryDisabled, jQuery } from '@ember/-internals/views';
-
-import Test from '../lib/test';
-import setupForTesting from '../lib/setup_for_testing';
-
-import {
- pendingRequests,
- incrementPendingRequests,
- decrementPendingRequests,
- clearPendingRequests,
-} from '../lib/test/pending_requests';
-import { setAdapter, getAdapter } from '../lib/test/adapter';
-import { registerWaiter, unregisterWaiter } from '../lib/test/waiters';
-import { getDebugFunction, setDebugFunction } from '@ember/debug';
-
-const originalInfo = getDebugFunction('info');
-const noop = function () {};
-
-function registerHelper() {
- Test.registerHelper('LeakyMcLeakLeak', () => {});
-}
-
-function assertHelpers(assert, application, helperContainer, expected) {
- if (!helperContainer) {
- helperContainer = window;
- }
- if (expected === undefined) {
- expected = true;
- }
-
- function checkHelperPresent(helper, expected) {
- let presentInHelperContainer = Boolean(helperContainer[helper]);
- let presentInTestHelpers = Boolean(application.testHelpers[helper]);
-
- assert.ok(
- presentInHelperContainer === expected,
- "Expected '" + helper + "' to be present in the helper container (defaults to window)."
- );
- assert.ok(
- presentInTestHelpers === expected,
- "Expected '" + helper + "' to be present in App.testHelpers."
- );
- }
-
- checkHelperPresent('visit', expected);
- checkHelperPresent('click', expected);
- checkHelperPresent('keyEvent', expected);
- checkHelperPresent('fillIn', expected);
- checkHelperPresent('wait', expected);
- checkHelperPresent('triggerEvent', expected);
-}
-
-function assertNoHelpers(assert, application, helperContainer) {
- assertHelpers(assert, application, helperContainer, false);
-}
-
-class HelpersTestCase extends AutobootApplicationTestCase {
- constructor() {
- super();
- this._originalAdapter = getAdapter();
- }
-
- teardown() {
- setAdapter(this._originalAdapter);
- document.removeEventListener('ajaxSend', incrementPendingRequests);
- document.removeEventListener('ajaxComplete', decrementPendingRequests);
- clearPendingRequests();
- if (this.application) {
- this.application.removeTestHelpers();
- }
- super.teardown();
- }
-}
-
-class HelpersApplicationTestCase extends HelpersTestCase {
- constructor() {
- super();
- runTask(() => {
- this.createApplication();
- this.application.setupForTesting();
- this.application.injectTestHelpers();
- });
- }
-}
-
-if (!jQueryDisabled) {
- moduleFor(
- 'ember-testing: Helper setup',
- class extends HelpersTestCase {
- [`@test Ember.Application#injectTestHelpers/#removeTestHelper`](assert) {
- runTask(() => {
- this.createApplication();
- });
-
- assertNoHelpers(assert, this.application);
-
- registerHelper();
-
- this.application.injectTestHelpers();
-
- assertHelpers(assert, this.application);
-
- assert.ok(Test.Promise.prototype.LeakyMcLeakLeak, 'helper in question SHOULD be present');
-
- this.application.removeTestHelpers();
-
- assertNoHelpers(assert, this.application);
-
- assert.equal(
- Test.Promise.prototype.LeakyMcLeakLeak,
- undefined,
- 'should NOT leak test promise extensions'
- );
- }
-
- [`@test Ember.Application#setupForTesting`](assert) {
- runTask(() => {
- this.createApplication();
- this.application.setupForTesting();
- });
-
- let routerInstance = this.applicationInstance.lookup('router:main');
- assert.equal(routerInstance.location, 'none');
- }
-
- [`@test Ember.Application.setupForTesting sets the application to 'testing'`](assert) {
- runTask(() => {
- this.createApplication();
- this.application.setupForTesting();
- });
-
- assert.equal(this.application.testing, true, 'Application instance is set to testing.');
- }
-
- [`@test Ember.Application.setupForTesting leaves the system in a deferred state.`](assert) {
- runTask(() => {
- this.createApplication();
- this.application.setupForTesting();
- });
-
- assert.equal(
- this.application._readinessDeferrals,
- 1,
- 'App is in deferred state after setupForTesting.'
- );
- }
-
- [`@test App.reset() after Application.setupForTesting leaves the system in a deferred state.`](
- assert
- ) {
- runTask(() => {
- this.createApplication();
- this.application.setupForTesting();
- });
-
- assert.equal(
- this.application._readinessDeferrals,
- 1,
- 'App is in deferred state after setupForTesting.'
- );
-
- this.application.reset();
-
- assert.equal(
- this.application._readinessDeferrals,
- 1,
- 'App is in deferred state after setupForTesting.'
- );
- }
-
- [`@test Ember.Application#injectTestHelpers calls callbacks registered with onInjectHelpers`](
- assert
- ) {
- let injected = 0;
-
- Test.onInjectHelpers(() => {
- injected++;
- });
-
- // bind(this) so Babel doesn't leak _this
- // into the context onInjectHelpers.
- runTask(
- function () {
- this.createApplication();
- this.application.setupForTesting();
- }.bind(this)
- );
-
- assert.equal(injected, 0, 'onInjectHelpers are not called before injectTestHelpers');
-
- this.application.injectTestHelpers();
-
- assert.equal(injected, 1, 'onInjectHelpers are called after injectTestHelpers');
- }
-
- [`@test Ember.Application#injectTestHelpers adds helpers to provided object.`](assert) {
- let helpers = {};
-
- runTask(() => {
- this.createApplication();
- this.application.setupForTesting();
- });
-
- this.application.injectTestHelpers(helpers);
-
- assertHelpers(assert, this.application, helpers);
-
- this.application.removeTestHelpers();
-
- assertNoHelpers(assert, this.application, helpers);
- }
-
- [`@test Ember.Application#removeTestHelpers resets the helperContainer's original values`](
- assert
- ) {
- let helpers = { visit: 'snazzleflabber' };
-
- runTask(() => {
- this.createApplication();
- this.application.setupForTesting();
- });
-
- this.application.injectTestHelpers(helpers);
-
- assert.notEqual(helpers.visit, 'snazzleflabber', 'helper added to container');
- this.application.removeTestHelpers();
-
- assert.equal(helpers.visit, 'snazzleflabber', 'original value added back to container');
- }
- }
- );
-
- moduleFor(
- 'ember-testing: Helper methods',
- class extends HelpersApplicationTestCase {
- [`@test 'wait' respects registerWaiters`](assert) {
- assert.expect(3);
-
- let counter = 0;
- function waiter() {
- return ++counter > 2;
- }
-
- let other = 0;
- function otherWaiter() {
- return ++other > 2;
- }
-
- runTask(() => {
- this.application.advanceReadiness();
- });
-
- registerWaiter(waiter);
- registerWaiter(otherWaiter);
-
- let {
- application: { testHelpers },
- } = this;
- return testHelpers
- .wait()
- .then(() => {
- assert.equal(waiter(), true, 'should not resolve until our waiter is ready');
- unregisterWaiter(waiter);
- counter = 0;
- return testHelpers.wait();
- })
- .then(() => {
- assert.equal(counter, 0, 'unregistered waiter was not checked');
- assert.equal(otherWaiter(), true, 'other waiter is still registered');
- })
- .finally(() => {
- unregisterWaiter(otherWaiter);
- });
- }
-
- [`@test 'visit' advances readiness.`](assert) {
- assert.expect(2);
-
- assert.equal(
- this.application._readinessDeferrals,
- 1,
- 'App is in deferred state after setupForTesting.'
- );
-
- return this.application.testHelpers.visit('/').then(() => {
- assert.equal(
- this.application._readinessDeferrals,
- 0,
- `App's readiness was advanced by visit.`
- );
- });
- }
-
- [`@test 'wait' helper can be passed a resolution value`](assert) {
- assert.expect(4);
-
- runTask(() => {
- this.application.advanceReadiness();
- });
-
- let promiseObjectValue = {};
- let objectValue = {};
- let {
- application: { testHelpers },
- } = this;
- return testHelpers
- .wait('text')
- .then((val) => {
- assert.equal(val, 'text', 'can resolve to a string');
- return testHelpers.wait(1);
- })
- .then((val) => {
- assert.equal(val, 1, 'can resolve to an integer');
- return testHelpers.wait(objectValue);
- })
- .then((val) => {
- assert.equal(val, objectValue, 'can resolve to an object');
- return testHelpers.wait(RSVP.resolve(promiseObjectValue));
- })
- .then((val) => {
- assert.equal(val, promiseObjectValue, 'can resolve to a promise resolution value');
- });
- }
-
- [`@test 'click' triggers appropriate events in order`](assert) {
- assert.expect(5);
-
- this.add(
- 'component:index-wrapper',
- Component.extend({
- classNames: 'index-wrapper',
-
- didInsertElement() {
- let wrapper = document.querySelector('.index-wrapper');
- wrapper.addEventListener('mousedown', (e) => events.push(e.type));
- wrapper.addEventListener('mouseup', (e) => events.push(e.type));
- wrapper.addEventListener('click', (e) => events.push(e.type));
- wrapper.addEventListener('focusin', (e) => events.push(e.type));
- },
- })
- );
-
- this.add(
- 'component:x-checkbox',
- Component.extend({
- tagName: 'input',
- attributeBindings: ['type'],
- type: 'checkbox',
- click() {
- events.push('click:' + this.get('checked'));
- },
- change() {
- events.push('change:' + this.get('checked'));
- },
- })
- );
-
- this.addTemplate(
- 'index',
- `
- {{#index-wrapper}}
- <Input @type="text"/>
- {{x-checkbox type="checkbox"}}
- {{textarea}}
- <div contenteditable="true"> </div>
- {{/index-wrapper}}'));
- `
- );
-
- runTask(() => {
- this.application.advanceReadiness();
- });
-
- let events;
- let {
- application: { testHelpers },
- } = this;
- return testHelpers
- .wait()
- .then(() => {
- events = [];
- return testHelpers.click('.index-wrapper');
- })
- .then(() => {
- assert.deepEqual(events, ['mousedown', 'mouseup', 'click'], 'fires events in order');
- })
- .then(() => {
- events = [];
- return testHelpers.click('.index-wrapper input[type=text]');
- })
- .then(() => {
- assert.deepEqual(
- events,
- ['mousedown', 'focusin', 'mouseup', 'click'],
- 'fires focus events on inputs'
- );
- })
- .then(() => {
- events = [];
- return testHelpers.click('.index-wrapper textarea');
- })
- .then(() => {
- assert.deepEqual(
- events,
- ['mousedown', 'focusin', 'mouseup', 'click'],
- 'fires focus events on textareas'
- );
- })
- .then(() => {
- events = [];
- return testHelpers.click('.index-wrapper div');
- })
- .then(() => {
- assert.deepEqual(
- events,
- ['mousedown', 'focusin', 'mouseup', 'click'],
- 'fires focus events on contenteditable'
- );
- })
- .then(() => {
- events = [];
- return testHelpers.click('.index-wrapper input[type=checkbox]');
- })
- .then(() => {
- // i.e. mousedown, mouseup, change:true, click, click:true
- // Firefox differs so we can't assert the exact ordering here.
- // See https://bugzilla.mozilla.org/show_bug.cgi?id=843554.
- assert.equal(events.length, 5, 'fires click and change on checkboxes');
- });
- }
-
- [`@test 'click' triggers native events with simulated X/Y coordinates`](assert) {
- assert.expect(15);
-
- this.add(
- 'component:index-wrapper',
- Component.extend({
- classNames: 'index-wrapper',
-
- didInsertElement() {
- let pushEvent = (e) => events.push(e);
- this.element.addEventListener('mousedown', pushEvent);
- this.element.addEventListener('mouseup', pushEvent);
- this.element.addEventListener('click', pushEvent);
- },
- })
- );
-
- this.addTemplate(
- 'index',
- `
- {{#index-wrapper}}some text{{/index-wrapper}}
- `
- );
-
- runTask(() => {
- this.application.advanceReadiness();
- });
-
- let events;
- let {
- application: {
- testHelpers: { wait, click },
- },
- } = this;
- return wait()
- .then(() => {
- events = [];
- return click('.index-wrapper');
- })
- .then(() => {
- events.forEach((e) => {
- assert.ok(e instanceof window.Event, 'The event is an instance of MouseEvent');
- assert.ok(typeof e.screenX === 'number', 'screenX is correct');
- assert.ok(typeof e.screenY === 'number', 'screenY is correct');
- assert.ok(typeof e.clientX === 'number', 'clientX is correct');
- assert.ok(typeof e.clientY === 'number', 'clientY is correct');
- });
- });
- }
-
- [`@test 'triggerEvent' with mouseenter triggers native events with simulated X/Y coordinates`](
- assert
- ) {
- assert.expect(5);
-
- let evt;
- this.add(
- 'component:index-wrapper',
- Component.extend({
- classNames: 'index-wrapper',
- didInsertElement() {
- this.element.addEventListener('mouseenter', (e) => (evt = e));
- },
- })
- );
-
- this.addTemplate('index', `{{#index-wrapper}}some text{{/index-wrapper}}`);
-
- runTask(() => {
- this.application.advanceReadiness();
- });
-
- let {
- application: {
- testHelpers: { wait, triggerEvent },
- },
- } = this;
- return wait()
- .then(() => {
- return triggerEvent('.index-wrapper', 'mouseenter');
- })
- .then(() => {
- assert.ok(evt instanceof window.Event, 'The event is an instance of MouseEvent');
- assert.ok(typeof evt.screenX === 'number', 'screenX is correct');
- assert.ok(typeof evt.screenY === 'number', 'screenY is correct');
- assert.ok(typeof evt.clientX === 'number', 'clientX is correct');
- assert.ok(typeof evt.clientY === 'number', 'clientY is correct');
- });
- }
-
- [`@test 'wait' waits for outstanding timers`](assert) {
- assert.expect(1);
-
- runTask(() => {
- this.application.advanceReadiness();
- });
-
- let waitDone = false;
- later(() => {
- waitDone = true;
- }, 20);
-
- return this.application.testHelpers.wait().then(() => {
- assert.equal(waitDone, true, 'should wait for the timer to be fired.');
- });
- }
-
- [`@test 'wait' respects registerWaiters with optional context`](assert) {
- assert.expect(3);
-
- let obj = {
- counter: 0,
- ready() {
- return ++this.counter > 2;
- },
- };
-
- let other = 0;
- function otherWaiter() {
- return ++other > 2;
- }
-
- runTask(() => {
- this.application.advanceReadiness();
- });
-
- registerWaiter(obj, obj.ready);
- registerWaiter(otherWaiter);
-
- let {
- application: {
- testHelpers: { wait },
- },
- } = this;
- return wait()
- .then(() => {
- assert.equal(obj.ready(), true, 'should not resolve until our waiter is ready');
- unregisterWaiter(obj, obj.ready);
- obj.counter = 0;
- return wait();
- })
- .then(() => {
- assert.equal(obj.counter, 0, 'the unregistered waiter should still be at 0');
- assert.equal(otherWaiter(), true, 'other waiter should still be registered');
- })
- .finally(() => {
- unregisterWaiter(otherWaiter);
- });
- }
-
- [`@test 'wait' does not error if routing has not begun`](assert) {
- assert.expect(1);
-
- return this.application.testHelpers.wait().then(() => {
- assert.ok(true, 'should not error without `visit`');
- });
- }
-
- [`@test 'triggerEvent' accepts an optional options hash without context`](assert) {
- assert.expect(3);
-
- let event;
- this.add(
- 'component:index-wrapper',
- Component.extend({
- didInsertElement() {
- let domElem = document.querySelector('.input');
- domElem.addEventListener('change', (e) => (event = e));
- domElem.addEventListener('keydown', (e) => (event = e));
- },
- })
- );
-
- this.addTemplate('index', `{{index-wrapper}}`);
- this.addTemplate(
- 'components/index-wrapper',
- `
- <Input @type="text" id="scope" class="input"/>
- `
- );
-
- runTask(() => {
- this.application.advanceReadiness();
- });
-
- let {
- application: {
- testHelpers: { wait, triggerEvent },
- },
- } = this;
- return wait()
- .then(() => {
- return triggerEvent('.input', 'keydown', { keyCode: 13 });
- })
- .then(() => {
- assert.equal(event.keyCode, 13, 'options were passed');
- assert.equal(event.type, 'keydown', 'correct event was triggered');
- assert.equal(
- event.target.getAttribute('id'),
- 'scope',
- 'triggered on the correct element'
- );
- });
- }
-
- [`@test 'triggerEvent' can limit searching for a selector to a scope`](assert) {
- assert.expect(2);
-
- let event;
- this.add(
- 'component:index-wrapper',
- Component.extend({
- didInsertElement() {
- let firstInput = document.querySelector('.input');
- firstInput.addEventListener('blur', (e) => (event = e));
- firstInput.addEventListener('change', (e) => (event = e));
- let secondInput = document.querySelector('#limited .input');
- secondInput.addEventListener('blur', (e) => (event = e));
- secondInput.addEventListener('change', (e) => (event = e));
- },
- })
- );
-
- this.addTemplate(
- 'components/index-wrapper',
- `
- <Input @type="text" id="outside-scope" class="input"/>
- <div id="limited">
- <Input @type="text" id="inside-scope" class="input"/>
- </div>
- `
- );
- this.addTemplate('index', `{{index-wrapper}}`);
-
- runTask(() => {
- this.application.advanceReadiness();
- });
-
- let {
- application: {
- testHelpers: { wait, triggerEvent },
- },
- } = this;
- return wait()
- .then(() => {
- return triggerEvent('.input', '#limited', 'blur');
- })
- .then(() => {
- assert.equal(event.type, 'blur', 'correct event was triggered');
- assert.equal(
- event.target.getAttribute('id'),
- 'inside-scope',
- 'triggered on the correct element'
- );
- });
- }
-
- [`@test 'triggerEvent' can be used to trigger arbitrary events`](assert) {
- assert.expect(2);
-
- let event;
- this.add(
- 'component:index-wrapper',
- Component.extend({
- didInsertElement() {
- let foo = document.getElementById('foo');
- foo.addEventListener('blur', (e) => (event = e));
- foo.addEventListener('change', (e) => (event = e));
- },
- })
- );
-
- this.addTemplate(
- 'components/index-wrapper',
- `
- <Input @type="text" id="foo"/>
- `
- );
- this.addTemplate('index', `{{index-wrapper}}`);
-
- runTask(() => {
- this.application.advanceReadiness();
- });
-
- let {
- application: {
- testHelpers: { wait, triggerEvent },
- },
- } = this;
- return wait()
- .then(() => {
- return triggerEvent('#foo', 'blur');
- })
- .then(() => {
- assert.equal(event.type, 'blur', 'correct event was triggered');
- assert.equal(
- event.target.getAttribute('id'),
- 'foo',
- 'triggered on the correct element'
- );
- });
- }
-
- [`@test 'fillIn' takes context into consideration`](assert) {
- assert.expect(2);
-
- this.addTemplate(
- 'index',
- `<div id="parent">
- <Input @type="text" id="first" class="current"/>
- </div>
- <Input @type="text" id="second" class="current"/>`
- );
-
- runTask(() => {
- this.application.advanceReadiness();
- });
-
- let {
- application: {
- testHelpers: { visit, fillIn, andThen, find },
- },
- } = this;
- visit('/');
- fillIn('.current', '#parent', 'current value');
-
- return andThen(() => {
- assert.equal(find('#first')[0].value, 'current value');
- assert.equal(find('#second')[0].value, '');
- });
- }
-
- [`@test 'fillIn' focuses on the element`](assert) {
- let wasFocused = false;
-
- this.add(
- 'controller:index',
- Controller.extend({
- wasFocused: action(function () {
- wasFocused = true;
- }),
- })
- );
-
- this.addTemplate(
- 'index',
- `<div id="parent">
- <Input @type="text" id="first" {{on "focusin" this.wasFocused}}/>
- </div>'`
- );
-
- runTask(() => {
- this.application.advanceReadiness();
- });
-
- let {
- application: {
- testHelpers: { visit, fillIn, andThen, find, wait },
- },
- } = this;
- visit('/');
- fillIn('#first', 'current value');
- andThen(() => {
- assert.ok(wasFocused, 'focusIn event was triggered');
-
- assert.equal(find('#first')[0].value, 'current value');
- });
-
- return wait();
- }
-
- [`@test 'fillIn' fires 'input' and 'change' events in the proper order`](assert) {
- assert.expect(1);
-
- let events = [];
- this.add(
- 'controller:index',
- Controller.extend({
- actions: {
- oninputHandler(e) {
- events.push(e.type);
- },
- onchangeHandler(e) {
- events.push(e.type);
- },
- },
- })
- );
-
- this.addTemplate(
- 'index',
- `<input type="text" id="first"
- oninput={{action "oninputHandler"}}
- onchange={{action "onchangeHandler"}}>`
- );
-
- runTask(() => {
- this.application.advanceReadiness();
- });
-
- let {
- application: {
- testHelpers: { visit, fillIn, andThen, wait },
- },
- } = this;
-
- visit('/');
- fillIn('#first', 'current value');
- andThen(() => {
- assert.deepEqual(
- events,
- ['input', 'change'],
- '`input` and `change` events are fired in the proper order'
- );
- });
-
- return wait();
- }
-
- [`@test 'fillIn' only sets the value in the first matched element`](assert) {
- this.addTemplate(
- 'index',
- `
- <input type="text" id="first" class="in-test">
- <input type="text" id="second" class="in-test">
- `
- );
-
- runTask(() => {
- this.application.advanceReadiness();
- });
-
- let {
- application: {
- testHelpers: { visit, fillIn, find, andThen, wait },
- },
- } = this;
-
- visit('/');
- fillIn('input.in-test', 'new value');
- andThen(() => {
- assert.equal(find('#first')[0].value, 'new value');
- assert.equal(find('#second')[0].value, '');
- });
-
- return wait();
- }
-
- [`@test 'triggerEvent' accepts an optional options hash and context`](assert) {
- assert.expect(3);
-
- let event;
- this.add(
- 'component:index-wrapper',
- Component.extend({
- didInsertElement() {
- let firstInput = document.querySelector('.input');
- firstInput.addEventListener('keydown', (e) => (event = e), false);
- firstInput.addEventListener('change', (e) => (event = e), false);
- let secondInput = document.querySelector('#limited .input');
- secondInput.addEventListener('keydown', (e) => (event = e), false);
- secondInput.addEventListener('change', (e) => (event = e), false);
- },
- })
- );
-
- this.addTemplate(
- 'components/index-wrapper',
- `
- <Input @type="text" id="outside-scope" class="input"/>
- <div id="limited">
- <Input @type="text" id="inside-scope" class="input"/>
- </div>
- `
- );
- this.addTemplate('index', `{{index-wrapper}}`);
-
- runTask(() => {
- this.application.advanceReadiness();
- });
-
- let {
- application: {
- testHelpers: { wait, triggerEvent },
- },
- } = this;
- return wait()
- .then(() => {
- return triggerEvent('.input', '#limited', 'keydown', {
- keyCode: 13,
- });
- })
- .then(() => {
- assert.equal(event.keyCode, 13, 'options were passed');
- assert.equal(event.type, 'keydown', 'correct event was triggered');
- assert.equal(
- event.target.getAttribute('id'),
- 'inside-scope',
- 'triggered on the correct element'
- );
- });
- }
- }
- );
-
- moduleFor(
- 'ember-testing: debugging helpers',
- class extends HelpersApplicationTestCase {
- afterEach() {
- super.afterEach();
- setDebugFunction('info', originalInfo);
- }
-
- constructor() {
- super();
- runTask(() => {
- this.application.advanceReadiness();
- });
- }
-
- [`@test pauseTest pauses`](assert) {
- assert.expect(1);
- // overwrite info to suppress the console output (see https://github.com/emberjs/ember.js/issues/16391)
- setDebugFunction('info', noop);
-
- let { andThen, pauseTest } = this.application.testHelpers;
-
- andThen(() => {
- Test.adapter.asyncStart = () => {
- assert.ok(true, 'Async start should be called after waiting for other helpers');
- };
- });
-
- pauseTest();
- }
-
- [`@test resumeTest resumes paused tests`](assert) {
- assert.expect(1);
- // overwrite info to suppress the console output (see https://github.com/emberjs/ember.js/issues/16391)
- setDebugFunction('info', noop);
-
- let {
- application: {
- testHelpers: { pauseTest, resumeTest },
- },
- } = this;
-
- later(() => resumeTest(), 20);
- return pauseTest().then(() => {
- assert.ok(true, 'pauseTest promise was resolved');
- });
- }
-
- [`@test resumeTest throws if nothing to resume`](assert) {
- assert.expect(1);
-
- assert.throws(() => {
- this.application.testHelpers.resumeTest();
- }, /Testing has not been paused. There is nothing to resume./);
- }
- }
- );
-
- moduleFor(
- 'ember-testing: routing helpers',
- class extends HelpersTestCase {
- constructor() {
- super();
- runTask(() => {
- this.createApplication();
- this.application.setupForTesting();
- this.application.injectTestHelpers();
- this.router.map(function () {
- this.route('posts', { resetNamespace: true }, function () {
- this.route('new');
- this.route('edit', { resetNamespace: true });
- });
- });
- });
- runTask(() => {
- this.application.advanceReadiness();
- });
- }
-
- [`@test currentRouteName for '/'`](assert) {
- assert.expect(3);
-
- let {
- application: { testHelpers },
- } = this;
- return testHelpers.visit('/').then(() => {
- assert.equal(testHelpers.currentRouteName(), 'index', `should equal 'index'.`);
- assert.equal(testHelpers.currentPath(), 'index', `should equal 'index'.`);
- assert.equal(testHelpers.currentURL(), '/', `should equal '/'.`);
- });
- }
-
- [`@test currentRouteName for '/posts'`](assert) {
- assert.expect(3);
-
- let {
- application: { testHelpers },
- } = this;
- return testHelpers.visit('/posts').then(() => {
- assert.equal(
- testHelpers.currentRouteName(),
- 'posts.index',
- `should equal 'posts.index'.`
- );
- assert.equal(testHelpers.currentPath(), 'posts.index', `should equal 'posts.index'.`);
- assert.equal(testHelpers.currentURL(), '/posts', `should equal '/posts'.`);
- });
- }
-
- [`@test currentRouteName for '/posts/new'`](assert) {
- assert.expect(3);
-
- let {
- application: { testHelpers },
- } = this;
- return testHelpers.visit('/posts/new').then(() => {
- assert.equal(testHelpers.currentRouteName(), 'posts.new', `should equal 'posts.new'.`);
- assert.equal(testHelpers.currentPath(), 'posts.new', `should equal 'posts.new'.`);
- assert.equal(testHelpers.currentURL(), '/posts/new', `should equal '/posts/new'.`);
- });
- }
-
- [`@test currentRouteName for '/posts/edit'`](assert) {
- assert.expect(3);
-
- let {
- application: { testHelpers },
- } = this;
- return testHelpers.visit('/posts/edit').then(() => {
- assert.equal(testHelpers.currentRouteName(), 'edit', `should equal 'edit'.`);
- assert.equal(testHelpers.currentPath(), 'posts.edit', `should equal 'posts.edit'.`);
- assert.equal(testHelpers.currentURL(), '/posts/edit', `should equal '/posts/edit'.`);
- });
- }
- }
- );
-
- moduleFor(
- 'ember-testing: pendingRequests',
- class extends HelpersApplicationTestCase {
- trigger(type, xhr) {
- jQuery(document).trigger(type, xhr);
- }
-
- [`@test pendingRequests is maintained for ajaxSend and ajaxComplete events`](assert) {
- let done = assert.async();
- assert.equal(pendingRequests(), 0);
-
- let xhr = { some: 'xhr' };
-
- this.trigger('ajaxSend', xhr);
- assert.equal(pendingRequests(), 1, 'Ember.Test.pendingRequests was incremented');
-
- this.trigger('ajaxComplete', xhr);
- setTimeout(function () {
- assert.equal(pendingRequests(), 0, 'Ember.Test.pendingRequests was decremented');
- done();
- }, 0);
- }
-
- [`@test pendingRequests is ignores ajaxComplete events from past setupForTesting calls`](
- assert
- ) {
- assert.equal(pendingRequests(), 0);
-
- let xhr = { some: 'xhr' };
-
- this.trigger('ajaxSend', xhr);
- assert.equal(pendingRequests(), 1, 'Ember.Test.pendingRequests was incremented');
-
- setupForTesting();
-
- assert.equal(pendingRequests(), 0, 'Ember.Test.pendingRequests was reset');
-
- let altXhr = { some: 'more xhr' };
-
- this.trigger('ajaxSend', altXhr);
- assert.equal(pendingRequests(), 1, 'Ember.Test.pendingRequests was incremented');
-
- this.trigger('ajaxComplete', xhr);
- assert.equal(
- pendingRequests(),
- 1,
- 'Ember.Test.pendingRequests is not impressed with your unexpected complete'
- );
- }
-
- [`@test pendingRequests is reset by setupForTesting`](assert) {
- incrementPendingRequests();
-
- setupForTesting();
-
- assert.equal(pendingRequests(), 0, 'pendingRequests is reset');
- }
- }
- );
-
- moduleFor(
- 'ember-testing: async router',
- class extends HelpersTestCase {
- constructor() {
- super();
-
- runTask(() => {
- this.createApplication();
-
- this.router.map(function () {
- this.route('user', { resetNamespace: true }, function () {
- this.route('profile');
- this.route('edit');
- });
- });
-
- // Emulate a long-running unscheduled async operation.
- let resolveLater = () =>
- new RSVP.Promise((resolve) => {
- /*
- * The wait() helper has a 10ms tick. We should resolve() after
- * at least one tick to test whether wait() held off while the
- * async router was still loading. 20ms should be enough.
- */
- later(resolve, { firstName: 'Tom' }, 20);
- });
-
- this.add(
- 'route:user',
- Route.extend({
- model() {
- return resolveLater();
- },
- })
- );
-
- this.add(
- 'route:user.profile',
- Route.extend({
- beforeModel() {
- return resolveLater().then(() => {
- return expectDeprecation(() => {
- return this.transitionTo('user.edit');
- }, /Calling transitionTo on a route is deprecated/);
- });
- },
- })
- );
-
- this.application.setupForTesting();
- });
-
- this.application.injectTestHelpers();
- runTask(() => {
- this.application.advanceReadiness();
- });
- }
-
- [`@test currentRouteName for '/user'`](assert) {
- assert.expect(4);
-
- let {
- application: { testHelpers },
- } = this;
- return testHelpers.visit('/user').then(() => {
- assert.equal(testHelpers.currentRouteName(), 'user.index', `should equal 'user.index'.`);
- assert.equal(testHelpers.currentPath(), 'user.index', `should equal 'user.index'.`);
- assert.equal(testHelpers.currentURL(), '/user', `should equal '/user'.`);
- let userRoute = this.applicationInstance.lookup('route:user');
- assert.equal(userRoute.get('controller.model.firstName'), 'Tom', `should equal 'Tom'.`);
- });
- }
-
- [`@test currentRouteName for '/user/profile'`](assert) {
- assert.expect(5);
-
- let {
- application: { testHelpers },
- } = this;
- return testHelpers.visit('/user/profile').then(() => {
- assert.equal(testHelpers.currentRouteName(), 'user.edit', `should equal 'user.edit'.`);
- assert.equal(testHelpers.currentPath(), 'user.edit', `should equal 'user.edit'.`);
- assert.equal(testHelpers.currentURL(), '/user/edit', `should equal '/user/edit'.`);
- let userRoute = this.applicationInstance.lookup('route:user');
- assert.equal(userRoute.get('controller.model.firstName'), 'Tom', `should equal 'Tom'.`);
- });
- }
- }
- );
-
- moduleFor(
- 'ember-testing: can override built-in helpers',
- class extends HelpersTestCase {
- constructor() {
- super();
- runTask(() => {
- this.createApplication();
- this.application.setupForTesting();
- });
- this._originalVisitHelper = Test._helpers.visit;
- this._originalFindHelper = Test._helpers.find;
- }
-
- teardown() {
- Test._helpers.visit = this._originalVisitHelper;
- Test._helpers.find = this._originalFindHelper;
- super.teardown();
- }
-
- [`@test can override visit helper`](assert) {
- assert.expect(1);
-
- Test.registerHelper('visit', () => {
- assert.ok(true, 'custom visit helper was called');
- });
-
- this.application.injectTestHelpers();
-
- return this.application.testHelpers.visit();
- }
-
- [`@test can override find helper`](assert) {
- assert.expect(1);
-
- Test.registerHelper('find', () => {
- assert.ok(true, 'custom find helper was called');
-
- return ['not empty array'];
- });
-
- this.application.injectTestHelpers();
-
- return this.application.testHelpers.findWithAssert('.who-cares');
- }
- }
- );
-}
| true |
Other
|
emberjs
|
ember.js
|
c2b9023fc8ce2b81667cc80d25f73c2c1d084a06.json
|
Remove jQuery usage from ember-testing
As advised by feedback from core team, this removes all jQuery related testing helpers from ember-testing:
* `find`
* `findWithAssert`
* `triggerEvent`
* `keyEvent`
* `click`
* `fillIn`
All remaining helpers remain untouched for future official deprecation.
|
packages/ember-testing/tests/integration_test.js
|
@@ -1,106 +0,0 @@
-import { moduleFor, AutobootApplicationTestCase, runTask } from 'internal-test-helpers';
-import Test from '../lib/test';
-
-import { A as emberA } from '@ember/-internals/runtime';
-import { Route } from '@ember/-internals/routing';
-import { jQueryDisabled } from '@ember/-internals/views';
-
-moduleFor(
- 'ember-testing Integration tests of acceptance',
- class extends AutobootApplicationTestCase {
- constructor() {
- super();
-
- this.modelContent = [];
- this._originalAdapter = Test.adapter;
-
- runTask(() => {
- this.createApplication();
-
- this.addTemplate(
- 'people',
- `
- <div>
- {{#each @model as |person|}}
- <div class="name">{{person.firstName}}</div>
- {{/each}}
- </div>
- `
- );
-
- this.router.map(function () {
- this.route('people', { path: '/' });
- });
-
- this.add(
- 'route:people',
- Route.extend({
- model: () => this.modelContent,
- })
- );
-
- this.application.setupForTesting();
- });
-
- runTask(() => {
- this.application.reset();
- });
-
- this.application.injectTestHelpers();
- }
-
- teardown() {
- super.teardown();
- Test.adapter = this._originalAdapter;
- }
-
- [`@test template is bound to empty array of people`](assert) {
- if (!jQueryDisabled) {
- runTask(() => this.application.advanceReadiness());
- window.visit('/').then(() => {
- let rows = window.find('.name').length;
- assert.equal(rows, 0, 'successfully stubbed an empty array of people');
- });
- } else {
- runTask(() => this.application.advanceReadiness());
- window.visit('/').then(() => {
- expectAssertion(
- () => window.find('.name'),
- 'If jQuery is disabled, please import and use helpers from @ember/test-helpers [https://github.com/emberjs/ember-test-helpers]. Note: `find` is not an available helper.'
- );
- });
- }
- }
-
- [`@test template is bound to array of 2 people`](assert) {
- if (!jQueryDisabled) {
- this.modelContent = emberA([]);
- this.modelContent.pushObject({ firstName: 'x' });
- this.modelContent.pushObject({ firstName: 'y' });
-
- runTask(() => this.application.advanceReadiness());
- window.visit('/').then(() => {
- let rows = window.find('.name').length;
- assert.equal(rows, 2, 'successfully stubbed a non empty array of people');
- });
- } else {
- assert.expect(0);
- }
- }
-
- [`@test 'visit' can be called without advanceReadiness.`](assert) {
- if (!jQueryDisabled) {
- window.visit('/').then(() => {
- let rows = window.find('.name').length;
- assert.equal(
- rows,
- 0,
- 'stubbed an empty array of people without calling advanceReadiness.'
- );
- });
- } else {
- assert.expect(0);
- }
- }
- }
-);
| true |
Other
|
emberjs
|
ember.js
|
c2b9023fc8ce2b81667cc80d25f73c2c1d084a06.json
|
Remove jQuery usage from ember-testing
As advised by feedback from core team, this removes all jQuery related testing helpers from ember-testing:
* `find`
* `findWithAssert`
* `triggerEvent`
* `keyEvent`
* `click`
* `fillIn`
All remaining helpers remain untouched for future official deprecation.
|
tests/docs/expected.js
|
@@ -217,14 +217,12 @@ module.exports = {
'extend',
'factoryFor',
'fallback',
- 'fillIn',
'filter',
'filterBy',
'finally',
'find',
'findBy',
'findModel',
- 'findWithAssert',
'firstObject',
'flushWatchers',
'fn',
@@ -331,7 +329,6 @@ module.exports = {
'join',
'jQuery',
'keyDown',
- 'keyEvent',
'keyPress',
'keyUp',
'knownForType',
@@ -543,7 +540,6 @@ module.exports = {
'teardownViews',
'templateName',
'templateOnly',
- 'testCheckboxClick',
'testHelpers',
'testing',
'textarea',
@@ -561,7 +557,6 @@ module.exports = {
'translateToContainerFullname',
'trigger',
'triggerAction',
- 'triggerEvent',
'trySet',
'type',
'typeInjection',
| true |
Other
|
emberjs
|
ember.js
|
c2b9023fc8ce2b81667cc80d25f73c2c1d084a06.json
|
Remove jQuery usage from ember-testing
As advised by feedback from core team, this removes all jQuery related testing helpers from ember-testing:
* `find`
* `findWithAssert`
* `triggerEvent`
* `keyEvent`
* `click`
* `fillIn`
All remaining helpers remain untouched for future official deprecation.
|
yarn.lock
|
@@ -955,6 +955,8 @@
version "7.12.1"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.12.1.tgz#07640f28867ed16f9511c99c888291f560921cfa"
integrity sha512-Zaeq10naAsuHo7heQvyV0ptj4dlZJwZgNAtBYBnu5nNKJoW62m0zKcIEyVECrUKErkUkg6ajMy4ZfnVZciSBhg==
+ dependencies:
+ "@babel/helper-plugin-utils" "^7.10.4"
"@babel/plugin-transform-for-of@^7.9.0":
version "7.9.0"
@@ -1579,55 +1581,48 @@
minimatch "^3.0.4"
strip-json-comments "^3.1.1"
-"@glimmer/[email protected]":
- version "0.79.4"
- resolved "https://registry.yarnpkg.com/@glimmer/compiler/-/compiler-0.79.4.tgz#746909c5f01ad57efec15da79567b515d1e3a6b0"
- integrity sha512-aXTows4Kjbutp6BV18oQTFaJjIkX5+hQ25KVETK/5zla/rC9O0DQHGb2r8DDfx4DiJLXGdl4g2VLy/BfkYmcwA==
+"@glimmer/[email protected]":
+ version "0.80.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/compiler/-/compiler-0.80.0.tgz#f825b2d5b55500c0a695f076c7a2fdd312a1e94e"
+ integrity sha512-oz72cvjNHXpKY1i9aJBiLQSkmqW1zbCGc1J/gIGTXeMC5tdJlDXve22eS2ZkNWI41ai3ClzpA0hIz5ju7qO8zw==
dependencies:
- "@glimmer/interfaces" "0.79.4"
- "@glimmer/syntax" "0.79.4"
- "@glimmer/util" "0.79.4"
- "@glimmer/wire-format" "0.79.4"
+ "@glimmer/interfaces" "0.80.0"
+ "@glimmer/syntax" "0.80.0"
+ "@glimmer/util" "0.80.0"
+ "@glimmer/wire-format" "0.80.0"
"@simple-dom/interface" "^1.4.0"
-"@glimmer/[email protected]":
- version "0.79.4"
- resolved "https://registry.yarnpkg.com/@glimmer/destroyable/-/destroyable-0.79.4.tgz#23a3a13a50063aefb2fa169feae79a373c9132bf"
- integrity sha512-qpaglWv+GKlcm28MZvYemWTZV3kSlOKPc7kluRqXvoo7oqQdBEagm60XivMpxJUEf+A5YXsJ/Atty+r58eVvQg==
+"@glimmer/[email protected]":
+ version "0.80.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/destroyable/-/destroyable-0.80.0.tgz#48e6b3d01176b11d1025ccea1429e5d4a3303ee2"
+ integrity sha512-deyxvtKZZJtlo8bs5iiTtUgDT5K1LTzQM7HtgpOFUOsHU3O9dGtCIPQjIqE92H+BfT7UwOlhC3xcfyDhUALA+w==
dependencies:
"@glimmer/env" "0.1.7"
- "@glimmer/global-context" "0.79.4"
- "@glimmer/interfaces" "0.79.4"
- "@glimmer/util" "0.79.4"
+ "@glimmer/global-context" "0.80.0"
+ "@glimmer/interfaces" "0.80.0"
+ "@glimmer/util" "0.80.0"
-"@glimmer/[email protected]":
- version "0.79.4"
- resolved "https://registry.yarnpkg.com/@glimmer/encoder/-/encoder-0.79.4.tgz#2e2e7da3f80f21732f7ed0003c391caf4b42acfe"
- integrity sha512-qqyW/TWVK1RP/zEVq0NU2EvOViftVyB43BB7y2yVyb+qD3gK0weP1InwPp1tyNUF7B6LHAcd64d4pN29Qj3vHw==
+"@glimmer/[email protected]":
+ version "0.80.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/encoder/-/encoder-0.80.0.tgz#f529f525b44a94939b01e99c562e206bd9833df1"
+ integrity sha512-nCyF14OIRVixchzo0AML/TkpJV2znbYcFacUwJO67cVIMY/f14614fp63ipAHPcU+1AogIORAPT1wyUXbKcaaQ==
dependencies:
"@glimmer/env" "0.1.7"
- "@glimmer/interfaces" "0.79.4"
- "@glimmer/vm" "0.79.4"
+ "@glimmer/interfaces" "0.80.0"
+ "@glimmer/vm" "0.80.0"
"@glimmer/[email protected]", "@glimmer/env@^0.1.7":
version "0.1.7"
resolved "https://registry.yarnpkg.com/@glimmer/env/-/env-0.1.7.tgz#fd2d2b55a9029c6b37a6c935e8c8871ae70dfa07"
integrity sha1-/S0rVakCnGs3psk16MiHGucN+gc=
-"@glimmer/[email protected]":
- version "0.79.4"
- resolved "https://registry.yarnpkg.com/@glimmer/global-context/-/global-context-0.79.4.tgz#2d683a457aba7c340a3e850fdcf8a35fbcd8308e"
- integrity sha512-Hn6KS7QUV63oMbop1LVOfPZ3KISzq4xMASjP+xrMzLIugvjBYYB+WoarUJcG7eB+TioOo0OMyVFibSP8ZTO2TQ==
+"@glimmer/[email protected]":
+ version "0.80.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/global-context/-/global-context-0.80.0.tgz#09a0620e6625cc152769d9799dbb2f2d135959e3"
+ integrity sha512-1myqwTbsLdwP3MbYeLzBqPUMsUCqv+WxaLobHhWTo/dInF8SOyzzL9Dzox/TiqXydZx/w6sGfg9/a0g+MY5cxg==
dependencies:
"@glimmer/env" "^0.1.7"
-"@glimmer/[email protected]":
- version "0.79.4"
- resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.79.4.tgz#3213e7fe73f35340762bef7f4e8c8df593a4a8c8"
- integrity sha512-cyNZlRa7aXAfXY9kk7hhnWgL1R7Zw8wwi2UVEWq2nBanmpNmL1lSMJ6nY8oRIWCtWrYA9CeH7RZ6mVP5cQ/v2w==
- dependencies:
- "@simple-dom/interface" "^1.4.0"
-
"@glimmer/[email protected]":
version "0.80.0"
resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.80.0.tgz#eabc7551ffe7ad27c44ba96d39e2af6ebf01c942"
@@ -1640,48 +1635,41 @@
resolved "https://registry.yarnpkg.com/@glimmer/low-level/-/low-level-0.78.2.tgz#bca5f666760ce98345e87c5b3e37096e772cb2de"
integrity sha512-0S6TWOOd0fzLLysw1pWZN0TgasaHmYs1Sjz9Til1mTByIXU1S+1rhdyr2veSQPO/aRjPuEQyKXZQHvx23Zax6w==
-"@glimmer/[email protected]":
- version "0.79.4"
- resolved "https://registry.yarnpkg.com/@glimmer/manager/-/manager-0.79.4.tgz#82cefd85d503c5a3c40389f3c869a8abbf273648"
- integrity sha512-SCSrBEdu/JvTEFPvgkDu3kaRgJrJHrhAdB2WAoevNb8bMMhADxRPTVSfYDFL/6+eQtx6krcycVeeaCLjhZ2LNA==
+"@glimmer/[email protected]":
+ version "0.80.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/manager/-/manager-0.80.0.tgz#07eae00d0846ca1c44307ab0a03a6f6ebbe63065"
+ integrity sha512-rnRR1PQgqdmuKA/Lz9iVjhSK437Yws43QtfllCoUAPjlzqekJyR0oZiozlih+b3NSHhhU1hZhr2Xoo7lzhsyjQ==
dependencies:
- "@glimmer/destroyable" "0.79.4"
+ "@glimmer/destroyable" "0.80.0"
"@glimmer/env" "0.1.7"
- "@glimmer/interfaces" "0.79.4"
- "@glimmer/reference" "0.79.4"
- "@glimmer/util" "0.79.4"
- "@glimmer/validator" "0.79.4"
-
-"@glimmer/[email protected]":
- version "0.79.4"
- resolved "https://registry.yarnpkg.com/@glimmer/node/-/node-0.79.4.tgz#734ed99979fe8c396af3c356c0a5d5eee835d552"
- integrity sha512-EDv/PkLGf92aFc7J8qKtBUd6ewxC5udntN6Syj0VHJ2MQeikVJWyZHwJbZP5+VUw8AbjuSKPc0Nt8G37Y2xtug==
- dependencies:
- "@glimmer/interfaces" "0.79.4"
- "@glimmer/runtime" "0.79.4"
- "@glimmer/util" "0.79.4"
+ "@glimmer/interfaces" "0.80.0"
+ "@glimmer/reference" "0.80.0"
+ "@glimmer/util" "0.80.0"
+ "@glimmer/validator" "0.80.0"
+
+"@glimmer/[email protected]":
+ version "0.80.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/node/-/node-0.80.0.tgz#afdd6acdd73f70b88a8e78e79f592139912047ce"
+ integrity sha512-wm3bSiWBljW5UwUII2MKu1GOLkaRha66c8RryiGP97uP0EriMXAUj9kAnhur+/oG15ME+Vp65zwx1nCVeXshYA==
+ dependencies:
+ "@glimmer/interfaces" "0.80.0"
+ "@glimmer/runtime" "0.80.0"
+ "@glimmer/util" "0.80.0"
"@simple-dom/document" "^1.4.0"
"@simple-dom/interface" "^1.4.0"
-"@glimmer/[email protected]":
- version "0.79.4"
- resolved "https://registry.yarnpkg.com/@glimmer/opcode-compiler/-/opcode-compiler-0.79.4.tgz#c5dffda71216909a8b17d9ff3223a82ef018dde9"
- integrity sha512-K/29Wvy5nzo3deLGVZhoziznLsd8+psKhA8SO2zpS7a1a7HCSAL8SvXUZFsdsUZSU0gBmCPmw+sXSkyZTpu5CA==
+"@glimmer/[email protected]":
+ version "0.80.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/opcode-compiler/-/opcode-compiler-0.80.0.tgz#adb6bf7cf374b09d48a2f7365a3d4c80f1944a14"
+ integrity sha512-lvRZ0QCmbsp72u6EKpo1H3LVhq2oKLEGWj7SuIgexnLoVQvPWMfTvGHnh08XOAIAkp15LlVB240V9RWfz0T8yw==
dependencies:
- "@glimmer/encoder" "0.79.4"
+ "@glimmer/encoder" "0.80.0"
"@glimmer/env" "0.1.7"
- "@glimmer/interfaces" "0.79.4"
- "@glimmer/reference" "0.79.4"
- "@glimmer/util" "0.79.4"
- "@glimmer/vm" "0.79.4"
- "@glimmer/wire-format" "0.79.4"
-
-"@glimmer/[email protected]":
- version "0.79.4"
- resolved "https://registry.yarnpkg.com/@glimmer/owner/-/owner-0.79.4.tgz#ebb300eaf23986c94705cbff8c4415ed1eaad9e9"
- integrity sha512-6w24OglbMeib1xJVxOnTBoiCQbeLtDLDSzisn9z3o6+Iv3NCMzylyjv25JU9TqJydEPftDG/An/h/Aswb8iEFw==
- dependencies:
- "@glimmer/util" "0.79.4"
+ "@glimmer/interfaces" "0.80.0"
+ "@glimmer/reference" "0.80.0"
+ "@glimmer/util" "0.80.0"
+ "@glimmer/vm" "0.80.0"
+ "@glimmer/wire-format" "0.80.0"
"@glimmer/[email protected]":
version "0.80.0"
@@ -1690,67 +1678,58 @@
dependencies:
"@glimmer/util" "0.80.0"
-"@glimmer/[email protected]":
- version "0.79.4"
- resolved "https://registry.yarnpkg.com/@glimmer/program/-/program-0.79.4.tgz#80cfda3261388caeeb66ccc46fac469d2e788b71"
- integrity sha512-8wvhs7xUTdbAtG+oV19PKSFsyFujnRjl4gPs76Pr7GLHX25XOBhGxL8TptPm0JShxuvB2TMZrBwMGc3rhe402g==
+"@glimmer/[email protected]":
+ version "0.80.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/program/-/program-0.80.0.tgz#5bcc2709757c36127568993a61e842351814b67e"
+ integrity sha512-gp9Lmctp5ECkb7o7fvwN40cusH1Wr/cD7x0IKg3bDFeXuYGc/nUEBlZoU3jMMlGgHjW5b4Mo6LiGkOOK3QWSCA==
dependencies:
- "@glimmer/encoder" "0.79.4"
+ "@glimmer/encoder" "0.80.0"
"@glimmer/env" "0.1.7"
- "@glimmer/interfaces" "0.79.4"
- "@glimmer/manager" "0.79.4"
- "@glimmer/opcode-compiler" "0.79.4"
- "@glimmer/util" "0.79.4"
+ "@glimmer/interfaces" "0.80.0"
+ "@glimmer/manager" "0.80.0"
+ "@glimmer/opcode-compiler" "0.80.0"
+ "@glimmer/util" "0.80.0"
-"@glimmer/[email protected]":
- version "0.79.4"
- resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.79.4.tgz#3d9fcf5e57c63583da14f243128a3195f650e568"
- integrity sha512-neCaUe9vqc/zGj1kNdm1ssHQ/9icC0BJd8xjYf6vAjiJ/TKEL+u+PfL8H8zqdWAK2al5zekNlhHFY55NxzX8bQ==
+"@glimmer/[email protected]":
+ version "0.80.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.80.0.tgz#a69d4c43d2d85fc4b840e8a56a77b4480bac5774"
+ integrity sha512-Yn2RLZEWPctbSLeJRiML7DO5wAOrQCfYy4WV5YuHg4JujE7aMoYLeBFNgbGmWcAmBYZjIjVeF1/Qr2USiT3FKA==
dependencies:
"@glimmer/env" "^0.1.7"
- "@glimmer/global-context" "0.79.4"
- "@glimmer/interfaces" "0.79.4"
- "@glimmer/util" "0.79.4"
- "@glimmer/validator" "0.79.4"
+ "@glimmer/global-context" "0.80.0"
+ "@glimmer/interfaces" "0.80.0"
+ "@glimmer/util" "0.80.0"
+ "@glimmer/validator" "0.80.0"
-"@glimmer/[email protected]":
- version "0.79.4"
- resolved "https://registry.yarnpkg.com/@glimmer/runtime/-/runtime-0.79.4.tgz#188044848721f710859c35eecec15293b8c98bba"
- integrity sha512-jacyHy7zQ39kR6c4BvPUXpnNDSybnFpFplnhsa0Fr8IqnXRTKqNv1KdfBwdbbPQNaojuV6vyWoh0jPErkcgh0w==
+"@glimmer/[email protected]":
+ version "0.80.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/runtime/-/runtime-0.80.0.tgz#ddf344cca65934e283edfcad002729315623c3b7"
+ integrity sha512-tAlbowztTW18jzOPwOhZiSPAwCL5VVVBHb+dC7cArosLudvDBqVWK7dD7AM3NX7N9Ru3NoCsis9Ql0zYI7tFGA==
dependencies:
- "@glimmer/destroyable" "0.79.4"
+ "@glimmer/destroyable" "0.80.0"
"@glimmer/env" "0.1.7"
- "@glimmer/global-context" "0.79.4"
- "@glimmer/interfaces" "0.79.4"
+ "@glimmer/global-context" "0.80.0"
+ "@glimmer/interfaces" "0.80.0"
"@glimmer/low-level" "0.78.2"
- "@glimmer/owner" "0.79.4"
- "@glimmer/program" "0.79.4"
- "@glimmer/reference" "0.79.4"
- "@glimmer/util" "0.79.4"
- "@glimmer/validator" "0.79.4"
- "@glimmer/vm" "0.79.4"
- "@glimmer/wire-format" "0.79.4"
+ "@glimmer/owner" "0.80.0"
+ "@glimmer/program" "0.80.0"
+ "@glimmer/reference" "0.80.0"
+ "@glimmer/util" "0.80.0"
+ "@glimmer/validator" "0.80.0"
+ "@glimmer/vm" "0.80.0"
+ "@glimmer/wire-format" "0.80.0"
"@simple-dom/interface" "^1.4.0"
-"@glimmer/[email protected]":
- version "0.79.4"
- resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.79.4.tgz#5aa21d4b3918238c24da3d640abc3b66150fc0c6"
- integrity sha512-NiMIoW2G0+sBfLYnvDaZ8o8Ul/3P/ezOT8U7ZvsHDGU5hXM2buFozyoSKLILTvAQ56izdfK9fKCsn0oi4ISx3w==
+"@glimmer/[email protected]":
+ version "0.80.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.80.0.tgz#5f9c2e5824fdc8f88ec3e71861598c339b6777c1"
+ integrity sha512-LP8I5MmcguUiHhahyF96dgjKrPE6l1QVl2rlJY23FkzPSVMtUAQxNsxHPZ7vqi+gu7wucNiOfIPNTh9avOr20Q==
dependencies:
- "@glimmer/interfaces" "0.79.4"
- "@glimmer/util" "0.79.4"
+ "@glimmer/interfaces" "0.80.0"
+ "@glimmer/util" "0.80.0"
"@handlebars/parser" "~2.0.0"
simple-html-tokenizer "^0.5.10"
-"@glimmer/[email protected]":
- version "0.79.4"
- resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.79.4.tgz#4762ed9b231482470cb9763332097d50042f9bde"
- integrity sha512-n2lEGzM9khM43HmKlig2lG5L5cHoL4tFzW21CZzmhMfc1IDCqHuP7s7924OsXSbLT1WB7B9sm/ZhnEj2nd+GiQ==
- dependencies:
- "@glimmer/env" "0.1.7"
- "@glimmer/interfaces" "0.79.4"
- "@simple-dom/interface" "^1.4.0"
-
"@glimmer/[email protected]":
version "0.80.0"
resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.80.0.tgz#286ec9e2c8c9e2f364e49272a3baf9d0fe3dc40c"
@@ -1760,36 +1739,36 @@
"@glimmer/interfaces" "0.80.0"
"@simple-dom/interface" "^1.4.0"
-"@glimmer/[email protected]":
- version "0.79.4"
- resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.79.4.tgz#35bc9c6b88d0681b372f1fba3969e6385465b8d7"
- integrity sha512-VLT9TozD3n3qwX9hOECn/d2Ig8PTn0Gl1FdiEpb04tldXWY0YL6oSoLEjH97R4KNqvati2jFQOOzyinzu9Ffkw==
+"@glimmer/[email protected]":
+ version "0.80.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.80.0.tgz#f93c221a681809e5e45451e21d58ad0a819a38c0"
+ integrity sha512-qjKKvHaxp7jT978FM1Ifa4aur/W1osPRrMFahQH5LjwMQEdLdk3OSyuxfTY6nTArnK0YJWJZPScrRD0lS2Wy9Q==
dependencies:
"@glimmer/env" "^0.1.7"
- "@glimmer/global-context" "0.79.4"
+ "@glimmer/global-context" "0.80.0"
-"@glimmer/[email protected]":
- version "0.79.4"
- resolved "https://registry.yarnpkg.com/@glimmer/vm-babel-plugins/-/vm-babel-plugins-0.79.4.tgz#317b9b85752abab903674b959ed9e00e1942ae23"
- integrity sha512-LEdgx6QXOAm+88TxgrvWvkUc6J6jPKmnMzW3IAiD7aIHasSl+/aKfZF0x3ICHyCXGaJGWI00mVKxd2n61aAY9g==
+"@glimmer/[email protected]":
+ version "0.80.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/vm-babel-plugins/-/vm-babel-plugins-0.80.0.tgz#e9a6b496501eed367b94c928dc48a954830af3b5"
+ integrity sha512-ZW6+L+FzjDZngGj87zn3MRRA/MrchC7Con33mCcI36v8u48maheB351uhQe+fBVU300IfyzNMvAdwdVKS5VIFw==
dependencies:
babel-plugin-debug-macros "^0.3.4"
-"@glimmer/[email protected]":
- version "0.79.4"
- resolved "https://registry.yarnpkg.com/@glimmer/vm/-/vm-0.79.4.tgz#1d0f00909c6b97b99d7c8bb11d1e7b958822dbd3"
- integrity sha512-enCXJlypgMTxWUupQWCPUvE41Gh4vsCIWVhqdh6ol+QGzRZBGvfXTz5xu5lTKPJQhFQsTn2ecVTKKVhqMOtzpA==
+"@glimmer/[email protected]":
+ version "0.80.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/vm/-/vm-0.80.0.tgz#435a8d846e7e6066c018018a71be403520e9b577"
+ integrity sha512-1oSNmMXS83o/+SO1dW1rdm6hHH5ZbCfZt0mrY4+UHFHnlt8RH24z4YN36kjBVczCX1DhZJOYUrwwE4FKBjKdaQ==
dependencies:
- "@glimmer/interfaces" "0.79.4"
- "@glimmer/util" "0.79.4"
+ "@glimmer/interfaces" "0.80.0"
+ "@glimmer/util" "0.80.0"
-"@glimmer/[email protected]":
- version "0.79.4"
- resolved "https://registry.yarnpkg.com/@glimmer/wire-format/-/wire-format-0.79.4.tgz#4074b1194650909e295c349e75d2cebb8a03c8bd"
- integrity sha512-QuGfVIX1ziyFDPzJaKZnbgyhzzz5a8s/B+xYg5ZEhMo5BHuyL1a3Gw+0qUMCPlVUIX0Uv+VWvI7NF9tH/ykiZA==
+"@glimmer/[email protected]":
+ version "0.80.0"
+ resolved "https://registry.yarnpkg.com/@glimmer/wire-format/-/wire-format-0.80.0.tgz#bea3da7973a6a70611bf45cfc15592dbec132091"
+ integrity sha512-DAUEqUxq0ymuzRStw51DMhTrRZdCBVPZ7K63YFLRud3pojaApWxgeOFlsLua9nRqR6wYSSKS0y2E0n0tPnRndA==
dependencies:
- "@glimmer/interfaces" "0.79.4"
- "@glimmer/util" "0.79.4"
+ "@glimmer/interfaces" "0.80.0"
+ "@glimmer/util" "0.80.0"
"@handlebars/parser@~2.0.0":
version "2.0.0"
@@ -5232,6 +5211,9 @@ find-babel-config@^1.1.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/find-babel-config/-/find-babel-config-1.2.0.tgz#a9b7b317eb5b9860cda9d54740a8c8337a2283a2"
integrity sha512-jB2CHJeqy6a820ssiqwrKMeyC6nNdmrcgkKWJWmpoxpE8RKciYJXCcXRq1h2AzCo5I5BJeN2tkGEO3hLTuePRA==
+ dependencies:
+ json5 "^0.5.1"
+ path-exists "^3.0.0"
find-index@^1.1.0:
version "1.1.0"
@@ -6601,11 +6583,6 @@ json-stringify-safe@~5.0.0:
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
integrity "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA=="
-json5@^0.5.1:
- version "0.5.1"
- resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821"
- integrity sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=
-
json5@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe"
@@ -10410,15 +10387,10 @@ [email protected]:
dependencies:
mkdirp "^0.5.1"
-ws@^7.2.3:
- version "7.2.5"
- resolved "https://registry.yarnpkg.com/ws/-/ws-7.2.5.tgz#abb1370d4626a5a9cd79d8de404aa18b3465d10d"
- integrity "sha1-q7E3DUYmpanNedjeQEqhizRl0Q0= sha512-C34cIU4+DB2vMyAbmEKossWq2ZQDr6QEyuuCzWrM9zfw1sGc0mYiJ0UnG9zzNykt49C2Fi34hvr2vssFQRS6EA=="
-
-ws@~7.4.2:
- version "7.4.2"
- resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.2.tgz#782100048e54eb36fe9843363ab1c68672b261dd"
- integrity "sha1-eCEABI5U6zb+mEM2OrHGhnKyYd0= sha512-T4tewALS3+qsrpGI/8dqNMLIVdq/g/85U98HPMa6F0m6xTbvhXU6RCQLqPH3+SlomNV/LdY6RXEbBpMH6EOJnA=="
+ws@^7.2.3, ws@~7.4.2:
+ version "7.4.6"
+ resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c"
+ integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==
xdg-basedir@^3.0.0:
version "3.0.0"
| true |
Other
|
emberjs
|
ember.js
|
9ee68e04c4ac146b635b6d5d00446d259ddef6ad.json
|
Add v4.0.0-beta.1 to CHANGELOG
(cherry picked from commit 8e1dde524457719c45ded9ef183afc4940653fff)
|
CHANGELOG.md
|
@@ -1,5 +1,49 @@
# Ember Changelog
+### v4.0.0-beta.1 (August 17, 2021)
+
+- [#19649](https://github.com/emberjs/ember.js/pull/19649) / [#19692](https://github.com/emberjs/ember.js/pull/19692) [DEPRECATION] Add deprecation warning to Ember.assign implementing [RFC #750](https://github.com/emberjs/rfcs/blob/master/text/0750-deprecate-ember-assign.md).
+- [#19227](https://github.com/emberjs/ember.js/pull/19227) [BUGFIX] Enable global event dispatcher listeners to be lazily created fixing Passive Listener Violation in Chrome
+- [#19542](https://github.com/emberjs/ember.js/pull/19542) [BUGFIX] Fix initializer test blueprints
+- [#19589](https://github.com/emberjs/ember.js/pull/19589) [BUGFIX] Don’t include type-tests in build output
+- [#19528](https://github.com/emberjs/ember.js/pull/19528) [CLEANUP] Remove Logger
+- [#19558](https://github.com/emberjs/ember.js/pull/19558) [CLEANUP] Remove IE11 support
+- [#19563](https://github.com/emberjs/ember.js/pull/19563) [CLEANUP] Remove internal Ember.assign usage
+- [#19636](https://github.com/emberjs/ember.js/pull/19636) [CLEANUP] Remove copy & Copyable
+- [#19638](https://github.com/emberjs/ember.js/pull/19638) [CLEANUP] Remove deprecated with
+- [#19639](https://github.com/emberjs/ember.js/pull/19639) [CLEANUP] Removes deprecated Private INVOKE API
+- [#19640](https://github.com/emberjs/ember.js/pull/19640) [CLEANUP] Remove old deprecations import path
+- [#19641](https://github.com/emberjs/ember.js/pull/19641) [CLEANUP] Remove isVisible
+- [#19642](https://github.com/emberjs/ember.js/pull/19642) [CLEANUP] Remove aliasMethod
+- [#19643](https://github.com/emberjs/ember.js/pull/19643) [CLEANUP] Remove deprecate without for and since
+- [#19644](https://github.com/emberjs/ember.js/pull/19644) [CLEANUP] Remove -in-element
+- [#19645](https://github.com/emberjs/ember.js/pull/19645) [CLEANUP] Remove tryInvoke
+- [#19646](https://github.com/emberjs/ember.js/pull/19646) [CLEANUP] Remove loc
+- [#19647](https://github.com/emberjs/ember.js/pull/19647) [CLEANUP] Remove Ember.merge
+- [#19648](https://github.com/emberjs/ember.js/pull/19648) [CLEANUP] Remove getWithDefault
+- [#19651](https://github.com/emberjs/ember.js/pull/19651) [CLEANUP] Remove LEGACY_OWNER
+- [#19652](https://github.com/emberjs/ember.js/pull/19652) [CLEANUP] Remove Globals Resolver
+- [#19653](https://github.com/emberjs/ember.js/pull/19653) [CLEANUP] Remove run and computed dot access
+- [#19654](https://github.com/emberjs/ember.js/pull/19654) [CLEANUP] Remove @ember/string methods from native prototype
+- [#19655](https://github.com/emberjs/ember.js/pull/19655) [CLEANUP] Remove meta-destruction-apis
+- [#19656](https://github.com/emberjs/ember.js/pull/19656) [CLEANUP] Remove string-based setComponentManager
+- [#19657](https://github.com/emberjs/ember.js/pull/19657) [CLEANUP] Remove hasBlock and hasBlockParams
+- [#19658](https://github.com/emberjs/ember.js/pull/19658) [CLEANUP] Remove sendAction and string action passing
+- [#19659](https://github.com/emberjs/ember.js/pull/19659) [CLEANUP] Remove renderTemplate, disconnectOutlet, render
+- [#19660](https://github.com/emberjs/ember.js/pull/19660) [CLEANUP] Remove attrs/attrs-arg-access
+- [#19661](https://github.com/emberjs/ember.js/pull/19661) [CLEANUP] Remove EMBER_EXTEND_PROTOTYPES
+- [#19663](https://github.com/emberjs/ember.js/pull/19663) [CLEANUP] Remove function prototype extensions
+- [#19665](https://github.com/emberjs/ember.js/pull/19665) [CLEANUP] Remove deprecated jQuery integration
+- [#19666](https://github.com/emberjs/ember.js/pull/19666) [CLEANUP] Remove jQuery integration in EventDispatcher
+- [#19667](https://github.com/emberjs/ember.js/pull/19667) [CLEANUP] Cleanup IE11 leftovers
+- [#19670](https://github.com/emberjs/ember.js/pull/19670) [CLEANUP] Remove .volatile()
+- [#19671](https://github.com/emberjs/ember.js/pull/19671) [CLEANUP] Remove .property()
+- [#19673](https://github.com/emberjs/ember.js/pull/19673) [CLEANUP] Remove computed deep each
+- [#19674](https://github.com/emberjs/ember.js/pull/19674) [CLEANUP] Remove ability to override computed property
+- [#19678](https://github.com/emberjs/ember.js/pull/19678) [CLEANUP] Remove window.Ember global
+- [#19695](https://github.com/emberjs/ember.js/pull/19695) [CLEANUP] Remove {{partial}}
+- [#19691](https://github.com/emberjs/ember.js/pull/19691) Add build assertion against `{{outlet named}}`
+
### v3.28.0 (August 9, 2021)
- [#19697](https://github.com/emberjs/ember.js/pull/19697) [BUGFIX] Ensure `deserializeQueryParam` is called for lazy routes
| false |
Other
|
emberjs
|
ember.js
|
7b9e496c6d2d691ead94f3a3c0608f1d8588ae15.json
|
Move transform to assertion
|
packages/ember-template-compiler/lib/plugins/assert-against-attrs.ts
|
@@ -8,26 +8,19 @@ import { EmberASTPluginEnvironment } from '../types';
*/
/**
- A Glimmer2 AST transformation that replaces all instances of
+ A Glimmer2 AST transformation that asserts against
```handlebars
- {{attrs.foo.bar}}
+ {{attrs.foo.bar}}
```
- to
-
- ```handlebars
- {{@foo.bar}}
- ```
-
- as well as `{{#if attrs.foo}}`, `{{deeply (nested attrs.foobar.baz)}}`,
- `{{this.attrs.foo}}` etc
+ ...as well as `{{#if attrs.foo}}`, `{{deeply (nested attrs.foobar.baz)}}`.
@private
- @class TransformAttrsToProps
+ @class AssertAgainstAttrs
*/
-export default function transformAttrsIntoArgs(env: EmberASTPluginEnvironment): ASTPlugin {
+export default function assertAgainstAttrs(env: EmberASTPluginEnvironment): ASTPlugin {
let { builders: b } = env.syntax;
let moduleName = env.meta?.moduleName;
@@ -39,7 +32,7 @@ export default function transformAttrsIntoArgs(env: EmberASTPluginEnvironment):
}
return {
- name: 'transform-attrs-into-args',
+ name: 'assert-against-attrs',
visitor: {
Program: {
@@ -64,21 +57,15 @@ export default function transformAttrsIntoArgs(env: EmberASTPluginEnvironment):
if (isAttrs(node, stack[stack.length - 1])) {
let path = b.path(node.original.substr(6)) as AST.PathExpression;
- if (node.this === false) {
- assert(
- `Using {{attrs}} to reference named arguments is not supported. {{attrs.${
- path.original
- }}} should be updated to {{@${path.original}}}. ${calculateLocationDisplay(
- moduleName,
- node.loc
- )}`,
- false
- );
- }
-
- path.original = `@${path.original}`;
- path.data = true;
- return path;
+ assert(
+ `Using {{attrs}} to reference named arguments is not supported. {{attrs.${
+ path.original
+ }}} should be updated to {{@${path.original}}}. ${calculateLocationDisplay(
+ moduleName,
+ node.loc
+ )}`,
+ node.this !== false
+ );
}
},
},
| true |
Other
|
emberjs
|
ember.js
|
7b9e496c6d2d691ead94f3a3c0608f1d8588ae15.json
|
Move transform to assertion
|
packages/ember-template-compiler/lib/plugins/index.ts
|
@@ -1,11 +1,11 @@
+import AssertAgainstAttrs from './assert-against-attrs';
import AssertAgainstDynamicHelpersModifiers from './assert-against-dynamic-helpers-modifiers';
import AssertAgainstNamedBlocks from './assert-against-named-blocks';
import AssertAgainstNamedOutlets from './assert-against-named-outlets';
import AssertInputHelperWithoutBlock from './assert-input-helper-without-block';
import AssertReservedNamedArguments from './assert-reserved-named-arguments';
import AssertSplattributeExpressions from './assert-splattribute-expression';
import TransformActionSyntax from './transform-action-syntax';
-import TransformAttrsIntoArgs from './transform-attrs-into-args';
import TransformEachInIntoEach from './transform-each-in-into-each';
import TransformEachTrackArray from './transform-each-track-array';
import TransformInElement from './transform-in-element';
@@ -24,7 +24,7 @@ export const RESOLUTION_MODE_TRANSFORMS = Object.freeze(
TransformQuotedBindingsIntoJustBindings,
AssertReservedNamedArguments,
TransformActionSyntax,
- TransformAttrsIntoArgs,
+ AssertAgainstAttrs,
TransformEachInIntoEach,
TransformLinkTo,
AssertInputHelperWithoutBlock,
| true |
Other
|
emberjs
|
ember.js
|
7b9e496c6d2d691ead94f3a3c0608f1d8588ae15.json
|
Move transform to assertion
|
packages/ember-template-compiler/tests/plugins/assert-against-attrs-test.js
|
@@ -2,67 +2,65 @@ import TransformTestCase from '../utils/transform-test-case';
import { moduleFor, RenderingTestCase } from 'internal-test-helpers';
moduleFor(
- 'ember-template-compiler: transforming attrs into @args',
+ 'ember-template-compiler: assert against attrs',
class extends TransformTestCase {
- ['@test it transforms attrs into @args']() {
+ ['@test it asserts against attrs']() {
expectAssertion(() => {
- this.assertTransformed(`{{attrs.foo}}`, `{{@foo}}`);
+ this.assertTransformed(`{{attrs.foo}}`, `{{attrs.foo}}`);
}, /Using {{attrs}} to reference named arguments is not supported. {{attrs.foo}} should be updated to {{@foo}}./);
expectAssertion(() => {
- this.assertTransformed(`{{attrs.foo.bar}}`, `{{@foo.bar}}`);
+ this.assertTransformed(`{{attrs.foo.bar}}`, `{{attrs.foo.bar}}`);
}, /Using {{attrs}} to reference named arguments is not supported. {{attrs.foo.bar}} should be updated to {{@foo.bar}}./);
expectAssertion(() => {
- this.assertTransformed(`{{if attrs.foo "foo"}}`, `{{if @foo "foo"}}`);
+ this.assertTransformed(`{{if attrs.foo "foo"}}`, `{{if attrs.foo "foo"}}`);
}, /Using {{attrs}} to reference named arguments is not supported. {{attrs.foo}} should be updated to {{@foo}}./);
expectAssertion(() => {
- this.assertTransformed(`{{#if attrs.foo}}{{/if}}`, `{{#if @foo}}{{/if}}`);
+ this.assertTransformed(`{{#if attrs.foo}}{{/if}}`, `{{#if attrs.foo}}{{/if}}`);
}, /Using {{attrs}} to reference named arguments is not supported. {{attrs.foo}} should be updated to {{@foo}}./);
expectAssertion(() => {
- this.assertTransformed(`{{deeply (nested attrs.foo.bar)}}`, `{{deeply (nested @foo.bar)}}`);
+ this.assertTransformed(
+ `{{deeply (nested attrs.foo.bar)}}`,
+ `{{deeply (nested attrs.foo.bar)}}`
+ );
}, /Using {{attrs}} to reference named arguments is not supported. {{attrs.foo.bar}} should be updated to {{@foo.bar}}./);
}
- ['@test it transforms this.attrs into @args']() {
- this.assertTransformed(`{{this.attrs.foo}}`, `{{@foo}}`);
-
- this.assertTransformed(`{{this.attrs.foo.bar}}`, `{{@foo.bar}}`);
-
- this.assertTransformed(`{{if this.attrs.foo "foo"}}`, `{{if @foo "foo"}}`);
-
- this.assertTransformed(`{{#if this.attrs.foo}}{{/if}}`, `{{#if @foo}}{{/if}}`);
-
+ ['@test it does not assert against this.attrs']() {
+ this.assertTransformed(`{{this.attrs.foo}}`, `{{this.attrs.foo}}`);
+ this.assertTransformed(`{{if this.attrs.foo "foo"}}`, `{{if this.attrs.foo "foo"}}`);
+ this.assertTransformed(`{{#if this.attrs.foo}}{{/if}}`, `{{#if this.attrs.foo}}{{/if}}`);
this.assertTransformed(
`{{deeply (nested this.attrs.foo.bar)}}`,
- `{{deeply (nested @foo.bar)}}`
+ `{{deeply (nested this.attrs.foo.bar)}}`
);
}
}
);
moduleFor(
- 'ember-template-compiler: not transforming block params named "attrs" into @args',
+ 'ember-template-compiler: not asserting against block params named "attrs"',
class extends RenderingTestCase {
- ["@test it doesn't transform block params"]() {
+ ["@test it doesn't assert block params"]() {
this.registerComponent('foo', {
template: '{{#let "foo" as |attrs|}}{{attrs}}{{/let}}',
});
this.render('<Foo />');
this.assertComponentElement(this.firstChild, { content: 'foo' });
}
- ["@test it doesn't transform component block params"]() {
+ ["@test it doesn't assert component block params"]() {
this.registerComponent('foo', {
template: '{{yield "foo"}}',
});
this.render('<Foo as |attrs|>{{attrs}}</Foo>');
this.assertComponentElement(this.firstChild, { content: 'foo' });
}
- ["@test it doesn't transform block params with nested keys"]() {
+ ["@test it doesn't assert block params with nested keys"]() {
this.registerComponent('foo', {
template: '{{yield (hash bar="baz")}}',
});
| true |
Other
|
emberjs
|
ember.js
|
c166010bac915977bda513d389e80d37074e0da2.json
|
Add v3.24.5 to CHANGELOG.md
(cherry picked from commit faf8a8f4ad1fc585aea36804b1e7b6c1435d1b06)
|
CHANGELOG.md
|
@@ -1,6 +1,6 @@
# Ember Changelog
-## v3.28.0 (August 9, 2021)
+### v3.28.0 (August 9, 2021)
- [#19697](https://github.com/emberjs/ember.js/pull/19697) [BUGFIX] Ensure `deserializeQueryParam` is called for lazy routes
- [#19681](https://github.com/emberjs/ember.js/pull/19681) [BUGFIX] Restore previous hash behavior
@@ -10,6 +10,11 @@
- [#19491](https://github.com/emberjs/ember.js/pull/19491) [BUGFIX] Fix `owner.lookup` `owner.register` behavior with `singleton: true` option
- [#19472](https://github.com/emberjs/ember.js/pull/19472) [BUGFIX] Prevent transformation of block params called `attrs`
+### v3.24.5 (August 9, 2021)
+
+- [#19685](https://github.com/emberjs/ember.js/pull/19685) Fix memory leak with `RouterService` under Chrome
+- [#19683](https://github.com/emberjs/ember.js/pull/19683) Ensure `super.willDestroy` is called correctly in `Router`'s `willDestroy`
+
### v3.27.5 (June 10, 2021)
- [#19597](https://github.com/emberjs/ember.js/pull/19597) [BIGFIX] Fix `<LinkTo>` with nested children
| false |
Other
|
emberjs
|
ember.js
|
c4e70e3567a239c41ba9c319df72f239b1530e0c.json
|
Add v3.24.4 to CHANGELOG.md.
(cherry picked from commit ca3107a82d0e41022101caed9060e075fd159fce)
|
CHANGELOG.md
|
@@ -63,6 +63,10 @@
- [#19441](https://github.com/emberjs/ember.js/pull/19441) Add automated publishing of weekly alpha releases to NPM
- [#19462](https://github.com/emberjs/ember.js/pull/19462) Use `positional` and `named` as the argument names in `ember g helper` blueprint
+### v3.24.4 (May 3, 2021)
+
+- [#19477](https://github.com/emberjs/ember.js/pull/19477) Allow `<LinkToExternal />` to override internal assertion
+
### v3.26.1 (March 24, 2021)
- [#19473](https://github.com/emberjs/ember.js/pull/19473) Update Glimmer VM to latest.
@@ -125,7 +129,6 @@
- [#19338](https://github.com/emberjs/ember.js/pull/19338) [BUGFIX] Add missing `deprecate` options (`for` + `since`)
- [#19342](https://github.com/emberjs/ember.js/pull/19342) [BUGFIX] Fix misleading LinkTo error message
-
### v3.24.3 (March 7, 2021)
- [#19448](https://github.com/emberjs/ember.js/pull/19448) Ensure query params are preserved through an intermediate loading state transition
| false |
Other
|
emberjs
|
ember.js
|
7683833ff3e12f796d8476b23cf7b3257c85d856.json
|
Add 3.28.0-beta.7 to CHANGELOG
(cherry picked from commit f65283d7985b58e8788c65cc92bc3cf70ecc2226)
|
CHANGELOG.md
|
@@ -1,5 +1,11 @@
# Ember Changelog
+### v3.28.0-beta.7 (August 2, 2021)
+
+- [#19681](https://github.com/emberjs/ember.js/pull/19681) [BUGFIX] Restore previous hash behavior
+- [#19685](https://github.com/emberjs/ember.js/pull/19685) [BUGFIX] Fix memory leak in RouterService
+- [#19690](https://github.com/emberjs/ember.js/pull/19690) [BUGFIX] Deprecates String.prototype.htmlSafe targeting Ember 4.0, as intended by the original deprecation.
+
### v3.28.0-beta.6 (June 21, 2021)
- [#19584](https://github.com/emberjs/ember.js/pull/19584) [BUGFIX] Ensure hash objects correctly entangle as dependencies
| false |
Other
|
emberjs
|
ember.js
|
edb3914e376dde6c5824e38f4b18f54721a9dd66.json
|
Fix assign polyfill
|
packages/@ember/polyfills/lib/assign.ts
|
@@ -29,7 +29,7 @@ export function assign(target: object, ...sources: object[]): object;
@public
@static
*/
-export function assign(target: object): object {
+export function assign(target: object, ...rest: object[]): object {
deprecate(
'Use of `assign` has been deprecated. Please use `Object.assign` or the spread operator instead.',
false,
@@ -44,5 +44,5 @@ export function assign(target: object): object {
}
);
- return Object.assign(target, ...arguments);
+ return Object.assign(target, ...rest);
}
| false |
Other
|
emberjs
|
ember.js
|
826daa772eec5151bb3072a41a55602f630267cf.json
|
Add deprecation warning to Ember.assign
|
packages/@ember/deprecated-features/index.ts
|
@@ -8,3 +8,4 @@ export const JQUERY_INTEGRATION = !!'3.9.0';
export const APP_CTRL_ROUTER_PROPS = !!'3.10.0-beta.1';
export const MOUSE_ENTER_LEAVE_MOVE_EVENTS = !!'3.13.0-beta.1';
export const PARTIALS = !!'3.15.0-beta.1';
+export const ASSIGN = !!'4.0.0';
| true |
Other
|
emberjs
|
ember.js
|
826daa772eec5151bb3072a41a55602f630267cf.json
|
Add deprecation warning to Ember.assign
|
packages/@ember/polyfills/lib/assign.ts
|
@@ -1,3 +1,5 @@
+import { deprecate } from '@ember/debug';
+
/**
@module @ember/polyfills
*/
@@ -28,6 +30,20 @@ export function assign(target: object, ...sources: any[]): any;
@static
*/
export function assign(target: object) {
+ deprecate(
+ 'Use of `assign` has been deprecated. Please use `Object.assign` or the spread operator instead.',
+ false,
+ {
+ id: 'ember-polyfills.deprecate-assign',
+ until: '5.0.0',
+ url: 'https://deprecations.emberjs.com/v4.x/#toc_ember-polyfills-deprecate-assign',
+ for: 'ember-source',
+ since: {
+ enabled: '4.0.0',
+ },
+ }
+ );
+
for (let i = 1; i < arguments.length; i++) {
let arg = arguments[i];
if (!arg) {
| true |
Other
|
emberjs
|
ember.js
|
826daa772eec5151bb3072a41a55602f630267cf.json
|
Add deprecation warning to Ember.assign
|
packages/@ember/polyfills/tests/assign_test.js
|
@@ -49,7 +49,9 @@ moduleFor(
'Ember.assign (polyfill)',
class extends AssignTests {
assign() {
- return assignPolyfill(...arguments);
+ return expectDeprecation(() => {
+ assignPolyfill(...arguments);
+ }, 'Use of `assign` has been deprecated. Please use `Object.assign` or the spread operator instead.');
}
}
);
| true |
Other
|
emberjs
|
ember.js
|
206af374dd78339b0670e566a3224893dd90c42e.json
|
Drop `Function` from `EXTEND_PROTOTYPES`
|
packages/@ember/-internals/environment/lib/env.ts
|
@@ -16,7 +16,7 @@ export const ENV = {
ENABLE_OPTIONAL_FEATURES: false,
/**
- Determines whether Ember should add to `Array`, `Function`, and `String`
+ Determines whether Ember should add to `Array` and `String`
native object prototypes, a few extra methods in order to provide a more
friendly API.
@@ -36,7 +36,6 @@ export const ENV = {
*/
EXTEND_PROTOTYPES: {
Array: true,
- Function: true,
String: true,
},
| false |
Other
|
emberjs
|
ember.js
|
392981c1b72e06705ac9d2c22d0ea6a846806543.json
|
Add build assertion against `{{outlet named}}`
Named outlets are effectively removed in Ember 4.0, as the render hook
and `renderTemplate` method which are used to configure them have been
removed. Add an assertion to catch anyone trying to use this API going
forward.
|
packages/@ember/-internals/glimmer/tests/integration/outlet-test.js
|
@@ -1,7 +1,5 @@
import { RenderingTestCase, moduleFor, runAppend, runTask } from 'internal-test-helpers';
-import { set } from '@ember/-internals/metal';
-
moduleFor(
'outlet view',
class extends RenderingTestCase {
@@ -131,144 +129,6 @@ moduleFor(
this.assertText('HIBYE');
}
- ['@test should support an optional name']() {
- this.registerTemplate('application', '<h1>HI</h1>{{outlet "special"}}');
- let outletState = {
- render: {
- owner: this.owner,
- into: undefined,
- outlet: 'main',
- name: 'application',
- controller: {},
- template: this.owner.lookup('template:application')(this.owner),
- },
- outlets: Object.create(null),
- };
-
- runTask(() => this.component.setOutletState(outletState));
-
- runAppend(this.component);
-
- this.assertText('HI');
-
- this.assertStableRerender();
-
- this.registerTemplate('special', '<p>BYE</p>');
- outletState.outlets.special = {
- render: {
- owner: this.owner,
- into: undefined,
- outlet: 'main',
- name: 'special',
- controller: {},
- template: this.owner.lookup('template:special')(this.owner),
- },
- outlets: Object.create(null),
- };
-
- runTask(() => this.component.setOutletState(outletState));
-
- this.assertText('HIBYE');
- }
-
- ['@test does not default outlet name when positional argument is present']() {
- this.registerTemplate('application', '<h1>HI</h1>{{outlet this.someUndefinedThing}}');
- let outletState = {
- render: {
- owner: this.owner,
- into: undefined,
- outlet: 'main',
- name: 'application',
- controller: {},
- template: this.owner.lookup('template:application')(this.owner),
- },
- outlets: Object.create(null),
- };
-
- runTask(() => this.component.setOutletState(outletState));
-
- runAppend(this.component);
-
- this.assertText('HI');
-
- this.assertStableRerender();
-
- this.registerTemplate('special', '<p>BYE</p>');
- outletState.outlets.main = {
- render: {
- owner: this.owner,
- into: undefined,
- outlet: 'main',
- name: 'special',
- controller: {},
- template: this.owner.lookup('template:special')(this.owner),
- },
- outlets: Object.create(null),
- };
-
- runTask(() => this.component.setOutletState(outletState));
-
- this.assertText('HI');
- }
-
- ['@test should support bound outlet name']() {
- let controller = { outletName: 'foo' };
- this.registerTemplate('application', '<h1>HI</h1>{{outlet this.outletName}}');
- let outletState = {
- render: {
- owner: this.owner,
- into: undefined,
- outlet: 'main',
- name: 'application',
- controller,
- template: this.owner.lookup('template:application')(this.owner),
- },
- outlets: Object.create(null),
- };
-
- runTask(() => this.component.setOutletState(outletState));
-
- runAppend(this.component);
-
- this.assertText('HI');
-
- this.assertStableRerender();
-
- this.registerTemplate('foo', '<p>FOO</p>');
- outletState.outlets.foo = {
- render: {
- owner: this.owner,
- into: undefined,
- outlet: 'main',
- name: 'foo',
- controller: {},
- template: this.owner.lookup('template:foo')(this.owner),
- },
- outlets: Object.create(null),
- };
-
- this.registerTemplate('bar', '<p>BAR</p>');
- outletState.outlets.bar = {
- render: {
- owner: this.owner,
- into: undefined,
- outlet: 'main',
- name: 'bar',
- controller: {},
- template: this.owner.lookup('template:bar')(this.owner),
- },
- outlets: Object.create(null),
- };
-
- runTask(() => this.component.setOutletState(outletState));
-
- this.assertText('HIFOO');
-
- runTask(() => set(controller, 'outletName', 'bar'));
-
- this.assertText('HIBAR');
- }
-
['@test outletState can pass through user code (liquid-fire initimate API) ']() {
this.registerTemplate(
'outer',
| true |
Other
|
emberjs
|
ember.js
|
392981c1b72e06705ac9d2c22d0ea6a846806543.json
|
Add build assertion against `{{outlet named}}`
Named outlets are effectively removed in Ember 4.0, as the render hook
and `renderTemplate` method which are used to configure them have been
removed. Add an assertion to catch anyone trying to use this API going
forward.
|
packages/ember-template-compiler/lib/plugins/assert-against-named-outlets.ts
|
@@ -0,0 +1,37 @@
+import { assert } from '@ember/debug';
+import { AST, ASTPlugin } from '@glimmer/syntax';
+import calculateLocationDisplay from '../system/calculate-location-display';
+import { EmberASTPluginEnvironment } from '../types';
+
+/**
+ @module ember
+*/
+
+/**
+ Prevents usage of named outlets, a legacy concept in Ember removed in 4.0.
+
+ @private
+ @class AssertAgainstNamedOutlets
+*/
+export default function assertAgainstNamedOutlets(env: EmberASTPluginEnvironment): ASTPlugin {
+ let moduleName = env.meta?.moduleName;
+
+ return {
+ name: 'assert-against-named-outlets',
+
+ visitor: {
+ MustacheStatement(node: AST.MustacheStatement) {
+ if (
+ node.path.type === 'PathExpression' &&
+ node.path.original === 'outlet' &&
+ node.params[0]
+ ) {
+ let sourceInformation = calculateLocationDisplay(moduleName, node.loc);
+ assert(
+ `Named outlets were removed in Ember 4.0. See https://deprecations.emberjs.com/v3.x#toc_route-render-template for guidance on alternative APIs for named outlet use cases. ${sourceInformation}`
+ );
+ }
+ },
+ },
+ };
+}
| true |
Other
|
emberjs
|
ember.js
|
392981c1b72e06705ac9d2c22d0ea6a846806543.json
|
Add build assertion against `{{outlet named}}`
Named outlets are effectively removed in Ember 4.0, as the render hook
and `renderTemplate` method which are used to configure them have been
removed. Add an assertion to catch anyone trying to use this API going
forward.
|
packages/ember-template-compiler/lib/plugins/index.ts
|
@@ -1,5 +1,6 @@
import AssertAgainstDynamicHelpersModifiers from './assert-against-dynamic-helpers-modifiers';
import AssertAgainstNamedBlocks from './assert-against-named-blocks';
+import AssertAgainstNamedOutlets from './assert-against-named-outlets';
import AssertInputHelperWithoutBlock from './assert-input-helper-without-block';
import AssertReservedNamedArguments from './assert-reserved-named-arguments';
import AssertSplattributeExpressions from './assert-splattribute-expression';
@@ -30,6 +31,7 @@ export const RESOLUTION_MODE_TRANSFORMS = Object.freeze(
TransformInElement,
AssertSplattributeExpressions,
TransformEachTrackArray,
+ AssertAgainstNamedOutlets,
TransformWrapMountAndOutlet,
!EMBER_NAMED_BLOCKS ? AssertAgainstNamedBlocks : null,
EMBER_DYNAMIC_HELPERS_AND_MODIFIERS
@@ -47,6 +49,7 @@ export const STRICT_MODE_TRANSFORMS = Object.freeze(
TransformInElement,
AssertSplattributeExpressions,
TransformEachTrackArray,
+ AssertAgainstNamedOutlets,
TransformWrapMountAndOutlet,
!EMBER_NAMED_BLOCKS ? AssertAgainstNamedBlocks : null,
!EMBER_DYNAMIC_HELPERS_AND_MODIFIERS ? AssertAgainstDynamicHelpersModifiers : null,
| true |
Other
|
emberjs
|
ember.js
|
392981c1b72e06705ac9d2c22d0ea6a846806543.json
|
Add build assertion against `{{outlet named}}`
Named outlets are effectively removed in Ember 4.0, as the render hook
and `renderTemplate` method which are used to configure them have been
removed. Add an assertion to catch anyone trying to use this API going
forward.
|
packages/ember-template-compiler/tests/plugins/assert-against-named-outlets-test.js
|
@@ -0,0 +1,26 @@
+import { compile } from '../../index';
+import { moduleFor, AbstractTestCase } from 'internal-test-helpers';
+
+moduleFor(
+ 'ember-template-compiler: assert-against-named-outlets',
+ class extends AbstractTestCase {
+ [`named outlets are asserted against`]() {
+ expectAssertion(() => {
+ compile(`{{outlet 'foo'}}`, {
+ moduleName: 'baz/foo-bar',
+ });
+ }, `Named outlets were removed in Ember 4.0. See https://deprecations.emberjs.com/v3.x#toc_route-render-template for guidance on alternative APIs for named outlet use cases. ('baz/foo-bar' @ L1:C5) `);
+
+ expectAssertion(() => {
+ compile(`{{outlet foo}}`, {
+ moduleName: 'baz/foo-bar',
+ });
+ }, `Named outlets were removed in Ember 4.0. See https://deprecations.emberjs.com/v3.x#toc_route-render-template for guidance on alternative APIs for named outlet use cases. ('baz/foo-bar' @ L1:C5) `);
+
+ // No assertion
+ compile(`{{outlet}}`, {
+ moduleName: 'baz/foo-bar',
+ });
+ }
+ }
+);
| true |
Other
|
emberjs
|
ember.js
|
851c11cfff4891ed6abff8abb47ff476f078d4c9.json
|
Remove ability to override computed property
|
packages/@ember/-internals/metal/lib/computed.ts
|
@@ -29,14 +29,12 @@ import {
} from './decorator';
import expandProperties from './expand_properties';
import { addObserver, setObserverSuspended } from './observer';
-import { defineProperty } from './properties';
import {
beginPropertyChanges,
endPropertyChanges,
notifyPropertyChange,
PROPERTY_DID_CHANGE,
} from './property_events';
-import { set } from './property_set';
export type ComputedPropertyGetter = (keyName: string) => any;
export type ComputedPropertySetter = (keyName: string, value: any, cachedValue?: any) => any;
@@ -432,9 +430,10 @@ export class ComputedProperty extends ComputedDescriptor {
this._throwReadOnlyError(obj, keyName);
}
- if (!this._setter) {
- return this.clobberSet(obj, keyName, value);
- }
+ assert(
+ `Cannot override the computed property \`${keyName}\` on ${toString(obj)}.`,
+ this._setter !== undefined
+ );
if (this._volatile) {
return this.volatileSet(obj, keyName, value);
@@ -501,29 +500,6 @@ export class ComputedProperty extends ComputedDescriptor {
throw new EmberError(`Cannot set read-only property "${keyName}" on object: ${inspect(obj)}`);
}
- clobberSet(obj: object, keyName: string, value: any): any {
- deprecate(
- `The ${toString(
- obj
- )}#${keyName} computed property was just overridden. This removes the computed property and replaces it with a plain value, and has been deprecated. If you want this behavior, consider defining a setter which does it manually.`,
- false,
- {
- id: 'computed-property.override',
- until: '4.0.0',
- url: 'https://deprecations.emberjs.com/v3.x#toc_computed-property-override',
- for: 'ember-source',
- since: {
- enabled: '3.9.0-beta.1',
- },
- }
- );
-
- let cachedValue = metaFor(obj).valueFor(keyName);
- defineProperty(obj, keyName, null, cachedValue);
- set(obj, keyName, value);
- return value;
- }
-
volatileSet(obj: object, keyName: string, value: any): any {
return this._setter!.call(obj, keyName, value);
}
| true |
Other
|
emberjs
|
ember.js
|
851c11cfff4891ed6abff8abb47ff476f078d4c9.json
|
Remove ability to override computed property
|
packages/@ember/-internals/metal/tests/computed_test.js
|
@@ -129,20 +129,6 @@ moduleFor(
assert.equal(count, 1, 'should only call getter once');
}
- ['@test can override volatile computed property'](assert) {
- obj = {};
-
- expectDeprecation(() => {
- defineProperty(obj, 'foo', computed(function () {}).volatile());
- }, 'Setting a computed property as volatile has been deprecated. Instead, consider using a native getter with native class syntax.');
-
- expectDeprecation(() => {
- set(obj, 'foo', 'boom');
- }, /The \[object Object\]#foo computed property was just overridden./);
-
- assert.equal(obj.foo, 'boom');
- }
-
['@test defining computed property should invoke property on set'](assert) {
obj = {};
let count = 0;
@@ -765,7 +751,7 @@ moduleFor(
assert.ok(testObj.get('aInt') === 123, 'cp has been updated too');
}
- ['@test setter can be omited'](assert) {
+ ['@test an omitted setter cannot be set later'](assert) {
let testObj = EmberObject.extend({
a: '1',
b: '2',
@@ -780,11 +766,9 @@ moduleFor(
assert.ok(testObj.get('aInt') === 1, 'getter works');
assert.ok(testObj.get('a') === '1');
- expectDeprecation(() => {
+ expectAssertion(() => {
testObj.set('aInt', '123');
- }, /The <\(unknown\):ember\d*>#aInt computed property was just overridden/);
-
- assert.ok(testObj.get('aInt') === '123', 'cp has been updated too');
+ }, /Cannot override the computed property `aInt` on <\(unknown\):ember\d*>./);
}
['@test getter can be omited'](assert) {
@@ -979,7 +963,9 @@ moduleFor(
moduleFor(
'computed - default setter',
class extends ComputedTestCase {
- async ["@test when setting a value on a computed property that doesn't handle sets"](assert) {
+ async ["@test raises assertion when setting a value on a computed property that doesn't handle sets"](
+ assert
+ ) {
obj = {};
let observerFired = false;
@@ -993,16 +979,13 @@ moduleFor(
addObserver(obj, 'foo', null, () => (observerFired = true));
- expectDeprecation(() => {
+ expectAssertion(() => {
set(obj, 'foo', 'bar');
- }, /The \[object Object\]#foo computed property was just overridden./);
-
- assert.equal(get(obj, 'foo'), 'bar', 'The set value is properly returned');
- assert.ok(typeof obj.foo === 'string', 'The computed property was removed');
+ }, /Cannot override the computed property `foo` on \[object Object\]./);
await runLoopSettled();
- assert.ok(observerFired, 'The observer was still notified');
+ assert.notOk(observerFired, 'The observer was not notified');
}
}
);
| true |
Other
|
emberjs
|
ember.js
|
851c11cfff4891ed6abff8abb47ff476f078d4c9.json
|
Remove ability to override computed property
|
packages/@ember/-internals/metal/tests/mixin/computed_test.js
|
@@ -111,7 +111,7 @@ moduleFor(
assert.ok(superSetOccurred, 'should pass set to _super after getting');
}
- ['@test setter behavior works properly when overriding computed properties'](assert) {
+ ['@test setter behavior asserts when overriding computed properties'](assert) {
let obj = {};
let MixinA = Mixin.create({
@@ -156,16 +156,9 @@ moduleFor(
);
cpWasCalled = false;
- expectDeprecation(() => {
+ expectAssertion(() => {
set(obj, 'cpWithoutSetter', 'test');
- }, /The \[object Object\]#cpWithoutSetter computed property was just overridden./);
-
- assert.equal(
- get(obj, 'cpWithoutSetter'),
- 'test',
- 'The default setter was called, the value is correct'
- );
- assert.ok(!cpWasCalled, 'The default setter was called, not the CP itself');
+ }, /Cannot override the computed property `cpWithoutSetter` on \[object Object\]./);
}
}
);
| true |
Other
|
emberjs
|
ember.js
|
851c11cfff4891ed6abff8abb47ff476f078d4c9.json
|
Remove ability to override computed property
|
packages/@ember/-internals/runtime/tests/system/object/create_test.js
|
@@ -262,7 +262,7 @@ moduleFor(
assert.equal(result.foo.bar, 'foo');
}
- ['@test does raise deprecation if descriptor is a computed property without a setter'](assert) {
+ ['@test does raise assertion if descriptor is a computed property without a setter']() {
let owner = buildOwner();
class FooService extends Service {
@@ -282,16 +282,12 @@ moduleFor(
owner.register('foo:main', FooObject);
owner.inject('foo:main', 'foo', 'service:bar');
- expectDeprecation(
- /The <.*>#foo computed property was just overridden. This removes the computed property and replaces it with a plain value, and has been deprecated. If you want this behavior, consider defining a setter which does it manually./
- );
-
- expectDeprecation(
- /A value was injected implicitly on the 'foo' computed property of an instance of <.*>. Implicit injection is now deprecated, please add an explicit injection for this value/
- );
-
- let result = owner.lookup('foo:main');
- assert.equal(result.foo.bar, 'bar');
+ expectAssertion(() => {
+ expectDeprecation(
+ /A value was injected implicitly on the 'foo' computed property of an instance of <.*>. Implicit injection is now deprecated, please add an explicit injection for this value/
+ );
+ owner.lookup('foo:main');
+ }, /Cannot override the computed property `foo` on <.*>./);
}
['@test does not raise deprecation if descriptor is a getter and equal to the implicit deprecation'](
| true |
Other
|
emberjs
|
ember.js
|
0d935ae62980856522c3b74dab39c60f09b9b880.json
|
Remove jQueryEventShim from link-to
|
packages/@ember/-internals/glimmer/lib/components/internal.ts
|
@@ -1,9 +1,7 @@
import { Owner, setOwner } from '@ember/-internals/owner';
import { guidFor } from '@ember/-internals/utils';
-import { jQuery, jQueryDisabled } from '@ember/-internals/views';
import { EMBER_MODERNIZED_BUILT_IN_COMPONENTS } from '@ember/canary-features';
import { assert, deprecate } from '@ember/debug';
-import { JQUERY_INTEGRATION } from '@ember/deprecated-features';
import {
CapturedArguments,
Destroyable,
@@ -552,25 +550,3 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
});
};
}
-
-export function jQueryEventShim(target: DeprecatingInternalComponentConstructor): void {
- if (JQUERY_INTEGRATION) {
- let { prototype } = target;
-
- let superListenerFor = prototype['listenerFor'];
-
- Object.defineProperty(prototype, 'listenerFor', {
- configurable: true,
- enumerable: false,
- value: function listenerFor(this: InternalComponent, name: string): EventListener {
- let listener = superListenerFor.call(this, name);
-
- if (jQuery && !jQueryDisabled) {
- return (event: Event) => listener(new jQuery.Event(event));
- } else {
- return listener;
- }
- },
- });
- }
-}
| true |
Other
|
emberjs
|
ember.js
|
0d935ae62980856522c3b74dab39c60f09b9b880.json
|
Remove jQueryEventShim from link-to
|
packages/@ember/-internals/glimmer/lib/components/link-to.ts
|
@@ -5,7 +5,6 @@ import { TargetActionSupport } from '@ember/-internals/runtime';
import { isSimpleClick } from '@ember/-internals/views';
import { EMBER_MODERNIZED_BUILT_IN_COMPONENTS } from '@ember/canary-features';
import { assert, debugFreeze, deprecate, warn } from '@ember/debug';
-import { JQUERY_INTEGRATION } from '@ember/deprecated-features';
import { EngineInstance, getEngineParent } from '@ember/engine';
import { flaggedInstrument } from '@ember/instrumentation';
import { action } from '@ember/object';
@@ -22,7 +21,6 @@ import InternalComponent, {
handleDeprecatedArguments,
handleDeprecatedAttributeArguments,
handleDeprecatedEventArguments,
- jQueryEventShim,
opaquify,
} from './internal';
@@ -710,8 +708,4 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
}
}
-if (JQUERY_INTEGRATION) {
- jQueryEventShim(LinkTo);
-}
-
export default opaquify(LinkTo, LinkToTemplate);
| true |
Other
|
emberjs
|
ember.js
|
339670ea8fbda3d8563e4a16b9ececaa79247cb6.json
|
Remove jQueryEventShim for input components
|
packages/@ember/-internals/glimmer/lib/components/abstract-input.ts
|
@@ -3,7 +3,6 @@ import { TargetActionSupport } from '@ember/-internals/runtime';
import { TextSupport } from '@ember/-internals/views';
import { EMBER_MODERNIZED_BUILT_IN_COMPONENTS } from '@ember/canary-features';
import { assert } from '@ember/debug';
-import { JQUERY_INTEGRATION } from '@ember/deprecated-features';
import { action } from '@ember/object';
import { isConstRef, isUpdatableRef, Reference, updateRef, valueForRef } from '@glimmer/reference';
import Component from '../component';
@@ -14,7 +13,6 @@ import InternalComponent, {
handleDeprecatedAttributeArguments,
handleDeprecatedEventArguments,
InternalComponentConstructor,
- jQueryEventShim,
} from './internal';
const UNINITIALIZED: unknown = Object.freeze({});
@@ -243,8 +241,4 @@ export function handleDeprecatedFeatures(
});
}
}
-
- if (JQUERY_INTEGRATION) {
- jQueryEventShim(target);
- }
}
| true |
Other
|
emberjs
|
ember.js
|
339670ea8fbda3d8563e4a16b9ececaa79247cb6.json
|
Remove jQueryEventShim for input components
|
packages/@ember/-internals/glimmer/tests/integration/components/input-angle-test.js
|
@@ -557,12 +557,13 @@ moduleFor(
['@test sends an action with `<Input @enter={{action "foo"}} />` when <enter> is pressed'](
assert
) {
- assert.expect(1);
+ assert.expect(2);
this.render(`<Input @enter={{action 'foo'}} />`, {
actions: {
- foo() {
+ foo(value, event) {
assert.ok(true, 'action was triggered');
+ assert.ok(event instanceof Event, 'Native event was passed');
},
},
});
@@ -581,9 +582,10 @@ moduleFor(
value: 'initial',
actions: {
- foo() {
+ foo(value, event) {
triggered++;
assert.ok(true, 'action was triggered');
+ assert.ok(event instanceof Event, 'Native event was passed');
},
},
});
@@ -647,12 +649,13 @@ moduleFor(
}
['@test sends `insert-newline` when <enter> is pressed'](assert) {
- assert.expect(1);
+ assert.expect(2);
this.render(`<Input @insert-newline={{action 'foo'}} />`, {
actions: {
- foo() {
+ foo(value, event) {
assert.ok(true, 'action was triggered');
+ assert.ok(event instanceof Event, 'Native event was passed');
},
},
});
@@ -665,12 +668,13 @@ moduleFor(
['@test sends an action with `<Input @escape-press={{action "foo"}} />` when <escape> is pressed'](
assert
) {
- assert.expect(1);
+ assert.expect(2);
this.render(`<Input @escape-press={{action 'foo'}} />`, {
actions: {
- foo() {
+ foo(value, event) {
assert.ok(true, 'action was triggered');
+ assert.ok(event instanceof Event, 'Native event was passed');
},
},
});
@@ -687,9 +691,10 @@ moduleFor(
() => {
this.render(`<Input @key-down={{action 'foo'}} />`, {
actions: {
- foo() {
+ foo(value, event) {
triggered++;
assert.ok(true, 'action was triggered');
+ assert.ok(event instanceof Event, 'Native event was passed');
},
},
});
@@ -712,9 +717,10 @@ moduleFor(
() => {
this.render(`<Input @key-up={{action 'foo'}} />`, {
actions: {
- foo() {
+ foo(value, event) {
triggered++;
assert.ok(true, 'action was triggered');
+ assert.ok(event instanceof Event, 'Native event was passed');
},
},
});
| true |
Other
|
emberjs
|
ember.js
|
339670ea8fbda3d8563e4a16b9ececaa79247cb6.json
|
Remove jQueryEventShim for input components
|
packages/@ember/-internals/glimmer/tests/integration/components/input-curly-test.js
|
@@ -387,12 +387,13 @@ moduleFor(
['@test sends an action with `{{input enter=(action "foo")}}` when <enter> is pressed'](
assert
) {
- assert.expect(1);
+ assert.expect(2);
this.render(`{{input enter=(action 'foo')}}`, {
actions: {
- foo() {
+ foo(value, event) {
assert.ok(true, 'action was triggered');
+ assert.ok(event instanceof Event, 'Native event was passed');
},
},
});
@@ -411,9 +412,10 @@ moduleFor(
value: 'initial',
actions: {
- foo() {
+ foo(value, event) {
triggered++;
assert.ok(true, 'action was triggered');
+ assert.ok(event instanceof Event, 'Native event was passed');
},
},
});
@@ -477,12 +479,13 @@ moduleFor(
}
['@test sends `insert-newline` when <enter> is pressed'](assert) {
- assert.expect(1);
+ assert.expect(2);
this.render(`{{input insert-newline=(action 'foo')}}`, {
actions: {
- foo() {
+ foo(value, event) {
assert.ok(true, 'action was triggered');
+ assert.ok(event instanceof Event, 'Native event was passed');
},
},
});
@@ -495,12 +498,13 @@ moduleFor(
['@test sends an action with `{{input escape-press=(action "foo")}}` when <escape> is pressed'](
assert
) {
- assert.expect(1);
+ assert.expect(2);
this.render(`{{input escape-press=(action 'foo')}}`, {
actions: {
- foo() {
+ foo(value, event) {
assert.ok(true, 'action was triggered');
+ assert.ok(event instanceof Event, 'Native event was passed');
},
},
});
@@ -517,9 +521,10 @@ moduleFor(
() => {
this.render(`{{input key-down=(action 'foo')}}`, {
actions: {
- foo() {
+ foo(value, event) {
triggered++;
assert.ok(true, 'action was triggered');
+ assert.ok(event instanceof Event, 'Native event was passed');
},
},
});
@@ -538,8 +543,9 @@ moduleFor(
() => {
this.render(`{{input key-up=(action 'foo')}}`, {
actions: {
- foo() {
+ foo(value, event) {
assert.ok(true, 'action was triggered');
+ assert.ok(event instanceof Event, 'Native event was passed');
},
},
});
| true |
Other
|
emberjs
|
ember.js
|
cfab47a45d16da734e8fbcad77ee9636c1bc9d11.json
|
Fix tests after removed deprecations
|
packages/@ember/-internals/glimmer/tests/integration/components/input-angle-test.js
|
@@ -557,7 +557,7 @@ moduleFor(
['@test sends an action with `<Input @enter={{action "foo"}} />` when <enter> is pressed'](
assert
) {
- assert.expect(2);
+ assert.expect(1);
this.render(`<Input @enter={{action 'foo'}} />`, {
actions: {
@@ -647,7 +647,7 @@ moduleFor(
}
['@test sends `insert-newline` when <enter> is pressed'](assert) {
- assert.expect(2);
+ assert.expect(1);
this.render(`<Input @insert-newline={{action 'foo'}} />`, {
actions: {
@@ -665,7 +665,7 @@ moduleFor(
['@test sends an action with `<Input @escape-press={{action "foo"}} />` when <escape> is pressed'](
assert
) {
- assert.expect(2);
+ assert.expect(1);
this.render(`<Input @escape-press={{action 'foo'}} />`, {
actions: {
| true |
Other
|
emberjs
|
ember.js
|
cfab47a45d16da734e8fbcad77ee9636c1bc9d11.json
|
Fix tests after removed deprecations
|
packages/@ember/-internals/glimmer/tests/integration/components/input-curly-test.js
|
@@ -387,7 +387,7 @@ moduleFor(
['@test sends an action with `{{input enter=(action "foo")}}` when <enter> is pressed'](
assert
) {
- assert.expect(2);
+ assert.expect(1);
this.render(`{{input enter=(action 'foo')}}`, {
actions: {
@@ -477,7 +477,7 @@ moduleFor(
}
['@test sends `insert-newline` when <enter> is pressed'](assert) {
- assert.expect(2);
+ assert.expect(1);
this.render(`{{input insert-newline=(action 'foo')}}`, {
actions: {
@@ -495,7 +495,7 @@ moduleFor(
['@test sends an action with `{{input escape-press=(action "foo")}}` when <escape> is pressed'](
assert
) {
- assert.expect(2);
+ assert.expect(1);
this.render(`{{input escape-press=(action 'foo')}}`, {
actions: {
| true |
Other
|
emberjs
|
ember.js
|
d0dc039a5d0bee7a1bbef0ab478fb13a0135cf15.json
|
Remove tests for jQuery events
|
packages/@ember/-internals/glimmer/tests/integration/components/input-angle-test.js
|
@@ -1,10 +1,10 @@
-import { RenderingTestCase, moduleFor, runDestroy, runTask } from 'internal-test-helpers';
+import { moduleFor, RenderingTestCase, runDestroy, runTask } from 'internal-test-helpers';
import { EMBER_MODERNIZED_BUILT_IN_COMPONENTS } from '@ember/canary-features';
import { action } from '@ember/object';
import { Checkbox, TextArea, TextField } from '@ember/-internals/glimmer';
import { set } from '@ember/-internals/metal';
import { TargetActionSupport } from '@ember/-internals/runtime';
-import { getElementView, jQueryDisabled, jQuery, TextSupport } from '@ember/-internals/views';
+import { getElementView, TextSupport } from '@ember/-internals/views';
import { Component } from '../../utils/helpers';
@@ -561,13 +561,8 @@ moduleFor(
this.render(`<Input @enter={{action 'foo'}} />`, {
actions: {
- foo(value, event) {
+ foo() {
assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
},
},
});
@@ -586,14 +581,9 @@ moduleFor(
value: 'initial',
actions: {
- foo(value, event) {
+ foo() {
triggered++;
assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
},
},
});
@@ -661,13 +651,8 @@ moduleFor(
this.render(`<Input @insert-newline={{action 'foo'}} />`, {
actions: {
- foo(value, event) {
+ foo() {
assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
},
},
});
@@ -684,13 +669,8 @@ moduleFor(
this.render(`<Input @escape-press={{action 'foo'}} />`, {
actions: {
- foo(value, event) {
+ foo() {
assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
},
},
});
@@ -707,14 +687,9 @@ moduleFor(
() => {
this.render(`<Input @key-down={{action 'foo'}} />`, {
actions: {
- foo(value, event) {
+ foo() {
triggered++;
assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
},
},
});
@@ -737,14 +712,9 @@ moduleFor(
() => {
this.render(`<Input @key-up={{action 'foo'}} />`, {
actions: {
- foo(value, event) {
+ foo() {
triggered++;
assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
},
},
});
| true |
Other
|
emberjs
|
ember.js
|
d0dc039a5d0bee7a1bbef0ab478fb13a0135cf15.json
|
Remove tests for jQuery events
|
packages/@ember/-internals/glimmer/tests/integration/components/input-curly-test.js
|
@@ -3,7 +3,6 @@ import { RenderingTestCase, moduleFor, runDestroy, runTask } from 'internal-test
import { EMBER_MODERNIZED_BUILT_IN_COMPONENTS } from '@ember/canary-features';
import { action } from '@ember/object';
import { set } from '@ember/-internals/metal';
-import { jQueryDisabled, jQuery } from '@ember/-internals/views';
import { Component } from '../../utils/helpers';
@@ -392,13 +391,8 @@ moduleFor(
this.render(`{{input enter=(action 'foo')}}`, {
actions: {
- foo(value, event) {
+ foo() {
assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
},
},
});
@@ -417,14 +411,9 @@ moduleFor(
value: 'initial',
actions: {
- foo(value, event) {
+ foo() {
triggered++;
assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
},
},
});
@@ -492,13 +481,8 @@ moduleFor(
this.render(`{{input insert-newline=(action 'foo')}}`, {
actions: {
- foo(value, event) {
+ foo() {
assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
},
},
});
@@ -515,13 +499,8 @@ moduleFor(
this.render(`{{input escape-press=(action 'foo')}}`, {
actions: {
- foo(value, event) {
+ foo() {
assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
},
},
});
@@ -538,14 +517,9 @@ moduleFor(
() => {
this.render(`{{input key-down=(action 'foo')}}`, {
actions: {
- foo(value, event) {
+ foo() {
triggered++;
assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
},
},
});
@@ -564,13 +538,8 @@ moduleFor(
() => {
this.render(`{{input key-up=(action 'foo')}}`, {
actions: {
- foo(value, event) {
+ foo() {
assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
},
},
});
| true |
Other
|
emberjs
|
ember.js
|
28804ab8c82f765b521e4959cd3a8e3d216b69dd.json
|
Remove jQuery integration in EventDispatcher
|
packages/@ember/-internals/glimmer/tests/integration/event-dispatcher-test.js
|
@@ -1,14 +1,12 @@
-import { RenderingTestCase, moduleFor, runTask } from 'internal-test-helpers';
+import { moduleFor, RenderingTestCase, runTask } from 'internal-test-helpers';
import { Component } from '../utils/helpers';
import { _getCurrentRunLoop } from '@ember/runloop';
import {
- subscribe as instrumentationSubscribe,
reset as instrumentationReset,
+ subscribe as instrumentationSubscribe,
} from '@ember/instrumentation';
import { EMBER_IMPROVED_INSTRUMENTATION } from '@ember/canary-features';
-import { jQueryDisabled, jQuery } from '@ember/-internals/views';
-import { DEBUG } from '@glimmer/env';
let canDataTransfer = Boolean(document.createEvent('HTMLEvents').dataTransfer);
@@ -273,6 +271,29 @@ moduleFor(
this.$('#is-done').trigger('click');
}
+ ['@test native event on text node does not throw on hasAttribute [ISSUE #16730]'](assert) {
+ this.registerComponent('x-foo', {
+ ComponentClass: Component.extend({
+ actions: {
+ someAction() {},
+ },
+ }),
+ template: `<a id="inner" href="#" {{action 'someAction'}}>test</a>`,
+ });
+
+ this.render(`{{x-foo id="outer"}}`);
+
+ let node = this.$('#inner')[0].childNodes[0];
+
+ runTask(() => {
+ let event = document.createEvent('HTMLEvents');
+ event.initEvent('mousemove', true, true);
+ node.dispatchEvent(event);
+ });
+
+ assert.ok(true);
+ }
+
['@test [DEPRECATED] delegated event listeners work for mouseEnter/Leave'](assert) {
let receivedEnterEvents = [];
let receivedLeaveEvents = [];
@@ -669,181 +690,3 @@ if (canDataTransfer) {
}
);
}
-
-if (jQueryDisabled) {
- moduleFor(
- 'EventDispatcher#native-events',
- class extends RenderingTestCase {
- ['@test native events are passed when jQuery is not present'](assert) {
- let receivedEvent;
-
- this.registerComponent('x-foo', {
- ComponentClass: Component.extend({
- click(event) {
- receivedEvent = event;
- },
- }),
- template: `<button id="foo">bar</button>`,
- });
-
- this.render(`{{x-foo}}`);
-
- runTask(() => this.$('#foo').click());
- assert.ok(receivedEvent, 'click event was triggered');
- assert.notOk(receivedEvent.originalEvent, 'event is not a jQuery.Event');
- }
-
- ['@test native event on text node does not throw on hasAttribute [ISSUE #16730]'](assert) {
- this.registerComponent('x-foo', {
- ComponentClass: Component.extend({
- actions: {
- someAction() {},
- },
- }),
- template: `<a id="inner" href="#" {{action 'someAction'}}>test</a>`,
- });
-
- this.render(`{{x-foo id="outer"}}`);
-
- let node = this.$('#inner')[0].childNodes[0];
-
- runTask(() => {
- let event = document.createEvent('HTMLEvents');
- event.initEvent('mousemove', true, true);
- node.dispatchEvent(event);
- });
-
- assert.ok(true);
- }
- }
- );
-} else {
- moduleFor(
- 'EventDispatcher#jquery-events',
- class extends RenderingTestCase {
- beforeEach() {
- this.jqueryIntegration = window.EmberENV._JQUERY_INTEGRATION;
- }
-
- afterEach() {
- window.EmberENV._JQUERY_INTEGRATION = this.jqueryIntegration;
- }
-
- ['@test jQuery events are passed when jQuery is present'](assert) {
- let receivedEvent;
-
- this.registerComponent('x-foo', {
- ComponentClass: Component.extend({
- click(event) {
- receivedEvent = event;
- },
- }),
- template: `<button id="foo">bar</button>`,
- });
-
- this.render(`{{x-foo}}`);
-
- runTask(() => this.$('#foo').click());
- assert.ok(receivedEvent, 'click event was triggered');
- assert.ok(receivedEvent instanceof jQuery.Event, 'event is a jQuery.Event');
- }
-
- ['@test accessing jQuery.Event#originalEvent is deprecated'](assert) {
- let receivedEvent;
-
- this.registerComponent('x-foo', {
- ComponentClass: Component.extend({
- click(event) {
- receivedEvent = event;
- },
- }),
- template: `<button id="foo">bar</button>`,
- });
-
- this.render(`{{x-foo}}`);
-
- runTask(() => this.$('#foo').click());
- expectDeprecation(() => {
- let { originalEvent } = receivedEvent;
- assert.ok(originalEvent, 'jQuery event has originalEvent property');
- assert.equal(originalEvent.type, 'click', 'properties of originalEvent are available');
- }, 'Accessing jQuery.Event specific properties is deprecated. Either use the ember-jquery-legacy addon to normalize events to native events, or explicitly opt into jQuery integration using @ember/optional-features.');
- }
-
- ['@test other jQuery.Event properties do not trigger deprecation'](assert) {
- let receivedEvent;
-
- this.registerComponent('x-foo', {
- ComponentClass: Component.extend({
- click(event) {
- receivedEvent = event;
- },
- }),
- template: `<button id="foo">bar</button>`,
- });
-
- this.render(`{{x-foo}}`);
-
- runTask(() => this.$('#foo').click());
- expectNoDeprecation(() => {
- receivedEvent.stopPropagation();
- receivedEvent.stopImmediatePropagation();
- receivedEvent.preventDefault();
- assert.ok(receivedEvent.bubbles, 'properties of jQuery event are available');
- assert.equal(receivedEvent.type, 'click', 'properties of jQuery event are available');
- });
- }
-
- ['@test accessing jQuery.Event#originalEvent does not trigger deprecations when jquery integration is explicitly enabled'](
- assert
- ) {
- let receivedEvent;
- window.EmberENV._JQUERY_INTEGRATION = true;
-
- this.registerComponent('x-foo', {
- ComponentClass: Component.extend({
- click(event) {
- receivedEvent = event;
- },
- }),
- template: `<button id="foo">bar</button>`,
- });
-
- this.render(`{{x-foo}}`);
-
- runTask(() => this.$('#foo').click());
- expectNoDeprecation(() => {
- let { originalEvent } = receivedEvent;
- assert.ok(originalEvent, 'jQuery event has originalEvent property');
- assert.equal(originalEvent.type, 'click', 'properties of originalEvent are available');
- });
- }
-
- [`@${
- DEBUG ? 'test' : 'skip'
- } accessing jQuery.Event#__originalEvent does not trigger deprecations to support ember-jquery-legacy`](
- assert
- ) {
- let receivedEvent;
-
- this.registerComponent('x-foo', {
- ComponentClass: Component.extend({
- click(event) {
- receivedEvent = event;
- },
- }),
- template: `<button id="foo">bar</button>`,
- });
-
- this.render(`{{x-foo}}`);
-
- runTask(() => this.$('#foo').click());
- expectNoDeprecation(() => {
- let { __originalEvent: originalEvent } = receivedEvent;
- assert.ok(originalEvent, 'jQuery event has __originalEvent property');
- assert.equal(originalEvent.type, 'click', 'properties of __originalEvent are available');
- });
- }
- }
- );
-}
| true |
Other
|
emberjs
|
ember.js
|
28804ab8c82f765b521e4959cd3a8e3d216b69dd.json
|
Remove jQuery integration in EventDispatcher
|
packages/@ember/-internals/views/lib/system/event_dispatcher.js
|
@@ -3,11 +3,9 @@ import { assert } from '@ember/debug';
import { get, set } from '@ember/-internals/metal';
import { Object as EmberObject } from '@ember/-internals/runtime';
import { getElementView } from '@ember/-internals/views';
-import { jQuery, jQueryDisabled } from './jquery';
import ActionManager from './action_manager';
-import addJQueryEventDeprecation from './jquery_event_deprecation';
import { contains } from './utils';
-import { JQUERY_INTEGRATION, MOUSE_ENTER_LEAVE_MOVE_EVENTS } from '@ember/deprecated-features';
+import { MOUSE_ENTER_LEAVE_MOVE_EVENTS } from '@ember/deprecated-features';
/**
@module ember
@@ -163,75 +161,47 @@ export default EmberObject.extend({
let rootElementSelector = get(this, 'rootElement');
let rootElement;
- if (!JQUERY_INTEGRATION || jQueryDisabled) {
- if (typeof rootElementSelector !== 'string') {
- rootElement = rootElementSelector;
- } else {
- rootElement = document.querySelector(rootElementSelector);
- }
-
- assert(
- `You cannot use the same root element (${
- get(this, 'rootElement') || rootElement.tagName
- }) multiple times in an Ember.Application`,
- !rootElement.classList.contains(ROOT_ELEMENT_CLASS)
- );
- assert(
- 'You cannot make a new Ember.Application using a root element that is a descendent of an existing Ember.Application',
- (() => {
- let target = rootElement.parentNode;
- do {
- if (target.classList.contains(ROOT_ELEMENT_CLASS)) {
- return false;
- }
-
- target = target.parentNode;
- } while (target && target.nodeType === 1);
-
- return true;
- })()
- );
- assert(
- 'You cannot make a new Ember.Application using a root element that is an ancestor of an existing Ember.Application',
- !rootElement.querySelector(ROOT_ELEMENT_SELECTOR)
- );
-
- rootElement.classList.add(ROOT_ELEMENT_CLASS);
-
- assert(
- `Unable to add '${ROOT_ELEMENT_CLASS}' class to root element (${
- get(this, 'rootElement') || rootElement.tagName
- }). Make sure you set rootElement to the body or an element in the body.`,
- rootElement.classList.contains(ROOT_ELEMENT_CLASS)
- );
+ if (typeof rootElementSelector !== 'string') {
+ rootElement = rootElementSelector;
} else {
- rootElement = jQuery(rootElementSelector);
- assert(
- `You cannot use the same root element (${
- rootElement.selector || rootElement[0].tagName
- }) multiple times in an Ember.Application`,
- !rootElement.is(ROOT_ELEMENT_SELECTOR)
- );
- assert(
- 'You cannot make a new Ember.Application using a root element that is a descendent of an existing Ember.Application',
- !rootElement.closest(ROOT_ELEMENT_SELECTOR).length
- );
- assert(
- 'You cannot make a new Ember.Application using a root element that is an ancestor of an existing Ember.Application',
- !rootElement.find(ROOT_ELEMENT_SELECTOR).length
- );
-
- rootElement.addClass(ROOT_ELEMENT_CLASS);
-
- if (!rootElement.is(ROOT_ELEMENT_SELECTOR)) {
- throw new TypeError(
- `Unable to add '${ROOT_ELEMENT_CLASS}' class to root element (${
- rootElement.selector || rootElement[0].tagName
- }). Make sure you set rootElement to the body or an element in the body.`
- );
- }
+ rootElement = document.querySelector(rootElementSelector);
}
+ assert(
+ `You cannot use the same root element (${
+ get(this, 'rootElement') || rootElement.tagName
+ }) multiple times in an Ember.Application`,
+ !rootElement.classList.contains(ROOT_ELEMENT_CLASS)
+ );
+ assert(
+ 'You cannot make a new Ember.Application using a root element that is a descendent of an existing Ember.Application',
+ (() => {
+ let target = rootElement.parentNode;
+ do {
+ if (target.classList.contains(ROOT_ELEMENT_CLASS)) {
+ return false;
+ }
+
+ target = target.parentNode;
+ } while (target && target.nodeType === 1);
+
+ return true;
+ })()
+ );
+ assert(
+ 'You cannot make a new Ember.Application using a root element that is an ancestor of an existing Ember.Application',
+ !rootElement.querySelector(ROOT_ELEMENT_SELECTOR)
+ );
+
+ rootElement.classList.add(ROOT_ELEMENT_CLASS);
+
+ assert(
+ `Unable to add '${ROOT_ELEMENT_CLASS}' class to root element (${
+ get(this, 'rootElement') || rootElement.tagName
+ }). Make sure you set rootElement to the body or an element in the body.`,
+ rootElement.classList.contains(ROOT_ELEMENT_CLASS)
+ );
+
// save off the final sanitized root element (for usage in setupHandler)
this._sanitizedRootElement = rootElement;
@@ -290,185 +260,144 @@ export default EmberObject.extend({
return; // nothing to do
}
- if (!JQUERY_INTEGRATION || jQueryDisabled) {
- let viewHandler = (target, event) => {
- let view = getElementView(target);
- let result = true;
+ let viewHandler = (target, event) => {
+ let view = getElementView(target);
+ let result = true;
- if (view) {
- result = view.handleEvent(eventName, event);
- }
+ if (view) {
+ result = view.handleEvent(eventName, event);
+ }
- return result;
- };
+ return result;
+ };
- let actionHandler = (target, event) => {
- let actionId = target.getAttribute('data-ember-action');
- let actions = ActionManager.registeredActions[actionId];
+ let actionHandler = (target, event) => {
+ let actionId = target.getAttribute('data-ember-action');
+ let actions = ActionManager.registeredActions[actionId];
- // In Glimmer2 this attribute is set to an empty string and an additional
- // attribute it set for each action on a given element. In this case, the
- // attributes need to be read so that a proper set of action handlers can
- // be coalesced.
- if (actionId === '') {
- let attributes = target.attributes;
- let attributeCount = attributes.length;
+ // In Glimmer2 this attribute is set to an empty string and an additional
+ // attribute it set for each action on a given element. In this case, the
+ // attributes need to be read so that a proper set of action handlers can
+ // be coalesced.
+ if (actionId === '') {
+ let attributes = target.attributes;
+ let attributeCount = attributes.length;
- actions = [];
+ actions = [];
- for (let i = 0; i < attributeCount; i++) {
- let attr = attributes.item(i);
- let attrName = attr.name;
+ for (let i = 0; i < attributeCount; i++) {
+ let attr = attributes.item(i);
+ let attrName = attr.name;
- if (attrName.indexOf('data-ember-action-') === 0) {
- actions = actions.concat(ActionManager.registeredActions[attr.value]);
- }
+ if (attrName.indexOf('data-ember-action-') === 0) {
+ actions = actions.concat(ActionManager.registeredActions[attr.value]);
}
}
+ }
- // We have to check for actions here since in some cases, jQuery will trigger
- // an event on `removeChild` (i.e. focusout) after we've already torn down the
- // action handlers for the view.
- if (!actions) {
- return;
- }
+ // We have to check for actions here since in some cases, jQuery will trigger
+ // an event on `removeChild` (i.e. focusout) after we've already torn down the
+ // action handlers for the view.
+ if (!actions) {
+ return;
+ }
- let result = true;
- for (let index = 0; index < actions.length; index++) {
- let action = actions[index];
+ let result = true;
+ for (let index = 0; index < actions.length; index++) {
+ let action = actions[index];
- if (action && action.eventName === eventName) {
- // return false if any of the action handlers returns false
- result = action.handler(event) && result;
- }
+ if (action && action.eventName === eventName) {
+ // return false if any of the action handlers returns false
+ result = action.handler(event) && result;
}
- return result;
- };
-
- // Special handling of events that don't bubble (event delegation does not work).
- // Mimics the way this is handled in jQuery,
- // see https://github.com/jquery/jquery/blob/899c56f6ada26821e8af12d9f35fa039100e838e/src/event.js#L666-L700
- if (MOUSE_ENTER_LEAVE_MOVE_EVENTS && EVENT_MAP[event] !== undefined) {
- let mappedEventType = EVENT_MAP[event];
- let origEventType = event;
-
- let createFakeEvent = (eventType, event) => {
- let fakeEvent = document.createEvent('MouseEvent');
- fakeEvent.initMouseEvent(
- eventType,
- false,
- false,
- event.view,
- event.detail,
- event.screenX,
- event.screenY,
- event.clientX,
- event.clientY,
- event.ctrlKey,
- event.altKey,
- event.shiftKey,
- event.metaKey,
- event.button,
- event.relatedTarget
- );
-
- // fake event.target as we don't dispatch the event
- Object.defineProperty(fakeEvent, 'target', { value: event.target, enumerable: true });
-
- return fakeEvent;
- };
-
- let handleMappedEvent = (this._eventHandlers[mappedEventType] = (event) => {
- let target = event.target;
- let related = event.relatedTarget;
-
- while (
- target &&
- target.nodeType === 1 &&
- (related === null || (related !== target && !contains(target, related)))
- ) {
- // mouseEnter/Leave don't bubble, so there is no logic to prevent it as with other events
- if (getElementView(target)) {
- viewHandler(target, createFakeEvent(origEventType, event));
- } else if (target.hasAttribute('data-ember-action')) {
- actionHandler(target, createFakeEvent(origEventType, event));
- }
+ }
+ return result;
+ };
+
+ // Special handling of events that don't bubble (event delegation does not work).
+ // Mimics the way this is handled in jQuery,
+ // see https://github.com/jquery/jquery/blob/899c56f6ada26821e8af12d9f35fa039100e838e/src/event.js#L666-L700
+ if (MOUSE_ENTER_LEAVE_MOVE_EVENTS && EVENT_MAP[event] !== undefined) {
+ let mappedEventType = EVENT_MAP[event];
+ let origEventType = event;
+
+ let createFakeEvent = (eventType, event) => {
+ let fakeEvent = document.createEvent('MouseEvent');
+ fakeEvent.initMouseEvent(
+ eventType,
+ false,
+ false,
+ event.view,
+ event.detail,
+ event.screenX,
+ event.screenY,
+ event.clientX,
+ event.clientY,
+ event.ctrlKey,
+ event.altKey,
+ event.shiftKey,
+ event.metaKey,
+ event.button,
+ event.relatedTarget
+ );
- // separate mouseEnter/Leave events are dispatched for each listening element
- // until the element (related) has been reached that the pointing device exited from/to
- target = target.parentNode;
- }
- });
-
- rootElement.addEventListener(mappedEventType, handleMappedEvent);
- } else {
- let handleEvent = (this._eventHandlers[event] = (event) => {
- let target = event.target;
-
- do {
- if (getElementView(target)) {
- if (viewHandler(target, event) === false) {
- event.preventDefault();
- event.stopPropagation();
- break;
- } else if (event.cancelBubble === true) {
- break;
- }
- } else if (
- typeof target.hasAttribute === 'function' &&
- target.hasAttribute('data-ember-action')
- ) {
- if (actionHandler(target, event) === false) {
- break;
- }
- }
+ // fake event.target as we don't dispatch the event
+ Object.defineProperty(fakeEvent, 'target', { value: event.target, enumerable: true });
- target = target.parentNode;
- } while (target && target.nodeType === 1);
- });
+ return fakeEvent;
+ };
- rootElement.addEventListener(event, handleEvent);
- }
- } else {
- rootElement.on(`${event}.ember`, '.ember-view', function (evt) {
- let view = getElementView(this);
- let result = true;
+ let handleMappedEvent = (this._eventHandlers[mappedEventType] = (event) => {
+ let target = event.target;
+ let related = event.relatedTarget;
+
+ while (
+ target &&
+ target.nodeType === 1 &&
+ (related === null || (related !== target && !contains(target, related)))
+ ) {
+ // mouseEnter/Leave don't bubble, so there is no logic to prevent it as with other events
+ if (getElementView(target)) {
+ viewHandler(target, createFakeEvent(origEventType, event));
+ } else if (target.hasAttribute('data-ember-action')) {
+ actionHandler(target, createFakeEvent(origEventType, event));
+ }
- if (view) {
- result = view.handleEvent(eventName, addJQueryEventDeprecation(evt));
+ // separate mouseEnter/Leave events are dispatched for each listening element
+ // until the element (related) has been reached that the pointing device exited from/to
+ target = target.parentNode;
}
-
- return result;
});
- rootElement.on(`${event}.ember`, '[data-ember-action]', (evt) => {
- let attributes = evt.currentTarget.attributes;
- let handledActions = [];
-
- evt = addJQueryEventDeprecation(evt);
-
- for (let i = 0; i < attributes.length; i++) {
- let attr = attributes.item(i);
- let attrName = attr.name;
-
- if (attrName.lastIndexOf('data-ember-action-', 0) !== -1) {
- let action = ActionManager.registeredActions[attr.value];
-
- // We have to check for action here since in some cases, jQuery will trigger
- // an event on `removeChild` (i.e. focusout) after we've already torn down the
- // action handlers for the view.
- if (action && action.eventName === eventName && handledActions.indexOf(action) === -1) {
- action.handler(evt);
- // Action handlers can mutate state which in turn creates new attributes on the element.
- // This effect could cause the `data-ember-action` attribute to shift down and be invoked twice.
- // To avoid this, we keep track of which actions have been handled.
- handledActions.push(action);
+ rootElement.addEventListener(mappedEventType, handleMappedEvent);
+ } else {
+ let handleEvent = (this._eventHandlers[event] = (event) => {
+ let target = event.target;
+
+ do {
+ if (getElementView(target)) {
+ if (viewHandler(target, event) === false) {
+ event.preventDefault();
+ event.stopPropagation();
+ break;
+ } else if (event.cancelBubble === true) {
+ break;
+ }
+ } else if (
+ typeof target.hasAttribute === 'function' &&
+ target.hasAttribute('data-ember-action')
+ ) {
+ if (actionHandler(target, event) === false) {
+ break;
}
}
- }
+
+ target = target.parentNode;
+ } while (target && target.nodeType === 1);
});
- }
+ rootElement.addEventListener(event, handleEvent);
+ }
this.lazyEvents.delete(event);
},
@@ -489,12 +418,8 @@ export default EmberObject.extend({
return;
}
- if (!JQUERY_INTEGRATION || jQueryDisabled) {
- for (let event in this._eventHandlers) {
- rootElement.removeEventListener(event, this._eventHandlers[event]);
- }
- } else {
- jQuery(rootElementSelector).off('.ember', '**');
+ for (let event in this._eventHandlers) {
+ rootElement.removeEventListener(event, this._eventHandlers[event]);
}
rootElement.classList.remove(ROOT_ELEMENT_CLASS);
| true |
Other
|
emberjs
|
ember.js
|
28804ab8c82f765b521e4959cd3a8e3d216b69dd.json
|
Remove jQuery integration in EventDispatcher
|
packages/@ember/-internals/views/lib/system/jquery_event_deprecation.js
|
@@ -1,64 +0,0 @@
-/* global Proxy */
-import { deprecate } from '@ember/debug';
-import { global } from '@ember/-internals/environment';
-import { DEBUG } from '@glimmer/env';
-import { JQUERY_INTEGRATION } from '@ember/deprecated-features';
-
-export default function addJQueryEventDeprecation(jqEvent) {
- if (DEBUG && JQUERY_INTEGRATION) {
- let boundFunctions = new Map();
-
- // wrap the jQuery event in a Proxy to add the deprecation message for originalEvent, according to RFC#294
- // we need a native Proxy here, so we can make sure that the internal use of originalEvent in jQuery itself does
- // not trigger a deprecation
- return new Proxy(jqEvent, {
- get(target, name) {
- switch (name) {
- case 'originalEvent':
- deprecate(
- 'Accessing jQuery.Event specific properties is deprecated. Either use the ember-jquery-legacy addon to normalize events to native events, or explicitly opt into jQuery integration using @ember/optional-features.',
- ((EmberENV) => {
- // this deprecation is intentionally checking `global.EmberENV` so
- // that we can ensure we _only_ deprecate in the case where jQuery
- // integration is enabled implicitly (e.g. "defaulted" to enabled)
- // as opposed to when the user explicitly opts in to using jQuery
- if (typeof EmberENV !== 'object' || EmberENV === null) return false;
-
- return EmberENV._JQUERY_INTEGRATION === true;
- })(global.EmberENV),
- {
- id: 'ember-views.event-dispatcher.jquery-event',
- until: '4.0.0',
- url: 'https://deprecations.emberjs.com/v3.x#toc_jquery-event',
- for: 'ember-source',
- since: {
- enabled: '3.9.0',
- },
- }
- );
- return target[name];
-
- // provide an escape hatch for ember-jquery-legacy to access originalEvent without a deprecation
- case '__originalEvent':
- return target.originalEvent;
-
- default:
- if (typeof target[name] === 'function') {
- // cache functions for reuse
- if (!boundFunctions.has(name)) {
- // for jQuery.Event methods call them with `target` as the `this` context, so they will access
- // `originalEvent` from the original jQuery event, not our proxy, thus not trigger the deprecation
- boundFunctions.set(name, target[name].bind(target));
- }
-
- return boundFunctions.get(name);
- }
- // same for jQuery's getter functions for simple properties
- return target[name];
- }
- },
- });
- }
-
- return jqEvent;
-}
| true |
Other
|
emberjs
|
ember.js
|
ceeeb5a6c22bae016df07c44470eb74831879b1b.json
|
Avoid global resolver in tests/node app setup
|
tests/node/helpers/setup-app.js
|
@@ -92,16 +92,23 @@ function createApplication() {
let app = this.Ember.Application.extend().create({
autoboot: false,
+ Resolver: {
+ create: (specifier) => {
+ return this.registry[specifier];
+ },
+ },
});
- app.Router = this.Ember.Router.extend({
+ let Router = this.Ember.Router.extend({
location: 'none',
});
if (this.routesCallback) {
- app.Router.map(this.routesCallback);
+ Router.map(this.routesCallback);
}
+ this.register('router:main', Router);
+
registerApplicationClasses(app, this.registry);
// Run application initializers
| false |
Other
|
emberjs
|
ember.js
|
8547049f81ec0f0928bc5786e9687f86f0f54f1a.json
|
Remove renderTemplate, disconnectOutlet, render
Removing these features also effectively removes support for named
outlets.
|
packages/@ember/-internals/glimmer/lib/syntax/outlet.ts
|
@@ -33,28 +33,6 @@ import { OutletState } from '../utils/outlet';
<MyFooter />
```
- You may also specify a name for the `{{outlet}}`, which is useful when using more than one
- `{{outlet}}` in a template:
-
- ```app/templates/application.hbs
- {{outlet "menu"}}
- {{outlet "sidebar"}}
- {{outlet "main"}}
- ```
-
- Your routes can then render into a specific one of these `outlet`s by specifying the `outlet`
- attribute in your `renderTemplate` function:
-
- ```app/routes/menu.js
- import Route from '@ember/routing/route';
-
- export default class MenuRoute extends Route {
- renderTemplate() {
- this.render({ outlet: 'menu' });
- }
- }
- ```
-
See the [routing guide](https://guides.emberjs.com/release/routing/rendering-a-template/) for more
information on how your `route` interacts with the `{{outlet}}` helper.
Note: Your content __will not render__ if there isn't an `{{outlet}}` for it.
| true |
Other
|
emberjs
|
ember.js
|
8547049f81ec0f0928bc5786e9687f86f0f54f1a.json
|
Remove renderTemplate, disconnectOutlet, render
Removing these features also effectively removes support for named
outlets.
|
packages/@ember/-internals/glimmer/tests/integration/application/debug-render-tree-test.ts
|
@@ -1,6 +1,5 @@
import {
ApplicationTestCase,
- expectDeprecation,
ModuleBasedTestResolver,
moduleFor,
strip,
@@ -180,117 +179,6 @@ if (ENV._DEBUG_RENDER_TREE) {
]);
}
- async '@test named outlets'() {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- this.addTemplate(
- 'application',
- strip`
- <div id="header">{{outlet "header"}}</div>
- {{outlet}}
- `
- );
- this.addTemplate('header', 'header');
- this.addTemplate('index', 'index');
-
- this.add(
- 'controller:index',
- class extends Controller {
- queryParams = ['showHeader'];
- showHeader = false;
- }
- );
-
- interface Model {
- showHeader: boolean;
- }
-
- this.add(
- 'route:index',
- class extends Route {
- queryParams = {
- showHeader: {
- refreshModel: true,
- },
- };
-
- model({ showHeader }: Model): Model {
- return { showHeader };
- }
-
- setupController(controller: Controller, { showHeader }: Model): void {
- controller.setProperties({ showHeader });
- }
-
- renderTemplate(_: Controller, { showHeader }: Model): void {
- expectDeprecation(() => this.render(), /Usage of `render` is deprecated/);
-
- if (showHeader) {
- expectDeprecation(
- () => this.render('header', { outlet: 'header' }),
- /Usage of `render` is deprecated/
- );
- } else {
- expectDeprecation(
- () => this.disconnectOutlet('header'),
- 'The usage of `disconnectOutlet` is deprecated.'
- );
- }
- }
- }
- );
-
- await this.visit('/');
-
- this.assertRenderTree([
- this.outlet({
- type: 'route-template',
- name: 'index',
- args: { positional: [], named: { model: { showHeader: false } } },
- instance: this.controllerFor('index'),
- template: 'my-app/templates/index.hbs',
- bounds: this.nodeBounds(this.element.lastChild),
- children: [],
- }),
- ]);
-
- await this.visit('/?showHeader');
-
- this.assertRenderTree([
- this.outlet('header', {
- type: 'route-template',
- name: 'header',
- args: { positional: [], named: { model: { showHeader: true } } },
- instance: this.controllerFor('index'),
- template: 'my-app/templates/header.hbs',
- bounds: this.elementBounds(this.element.firstChild),
- children: [],
- }),
- this.outlet({
- type: 'route-template',
- name: 'index',
- args: { positional: [], named: { model: { showHeader: true } } },
- instance: this.controllerFor('index'),
- template: 'my-app/templates/index.hbs',
- bounds: this.nodeBounds(this.element.lastChild),
- children: [],
- }),
- ]);
-
- await this.visit('/');
-
- this.assertRenderTree([
- this.outlet({
- type: 'route-template',
- name: 'index',
- args: { positional: [], named: { model: { showHeader: false } } },
- instance: this.controllerFor('index'),
- template: 'my-app/templates/index.hbs',
- bounds: this.nodeBounds(this.element.lastChild),
- children: [],
- }),
- ]);
- }
-
async '@test {{mount}}'() {
this.addTemplate(
'application',
| true |
Other
|
emberjs
|
ember.js
|
8547049f81ec0f0928bc5786e9687f86f0f54f1a.json
|
Remove renderTemplate, disconnectOutlet, render
Removing these features also effectively removes support for named
outlets.
|
packages/@ember/-internals/glimmer/tests/integration/application/rendering-test.js
|
@@ -439,78 +439,6 @@ moduleFor(
});
}
- ['@test it can render into named outlets']() {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- this.router.map(function () {
- this.route('colors');
- });
-
- this.addTemplate(
- 'application',
- strip`
- <nav>{{outlet "nav"}}</nav>
- <main>{{outlet}}</main>
- `
- );
-
- this.addTemplate(
- 'nav',
- strip`
- <a href="https://emberjs.com/">Ember</a>
- `
- );
-
- this.add(
- 'route:application',
- Route.extend({
- renderTemplate() {
- expectDeprecation(() => {
- this.render();
- this.render('nav', {
- into: 'application',
- outlet: 'nav',
- });
- }, /Usage of `render` is deprecated/);
- },
- })
- );
-
- this.add(
- 'route:colors',
- Route.extend({
- model() {
- return ['red', 'yellow', 'blue'];
- },
- })
- );
-
- this.addTemplate(
- 'colors',
- strip`
- <ul>
- {{#each @model as |item|}}
- <li>{{item}}</li>
- {{/each}}
- </ul>
- `
- );
-
- return this.visit('/colors').then(() => {
- this.assertInnerHTML(strip`
- <nav>
- <a href="https://emberjs.com/">Ember</a>
- </nav>
- <main>
- <ul>
- <li>red</li>
- <li>yellow</li>
- <li>blue</li>
- </ul>
- </main>
- `);
- });
- }
-
['@test it should update the outlets when switching between routes']() {
this.router.map(function () {
this.route('a');
@@ -601,114 +529,6 @@ moduleFor(
.then(() => this.assertText('b'));
}
- ['@test it should update correctly when the controller changes']() {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- this.router.map(function () {
- this.route('color', { path: '/colors/:color' });
- });
-
- this.add(
- 'route:color',
- Route.extend({
- model(params) {
- return { color: params.color };
- },
-
- renderTemplate(controller, model) {
- expectDeprecation(
- () => this.render({ controller: model.color, model }),
- /Usage of `render` is deprecated/
- );
- },
- })
- );
-
- this.add(
- 'controller:red',
- Controller.extend({
- color: 'red',
- })
- );
-
- this.add(
- 'controller:green',
- Controller.extend({
- color: 'green',
- })
- );
-
- this.addTemplate('color', 'model color: {{@model.color}}, controller color: {{this.color}}');
-
- return this.visit('/colors/red')
- .then(() => {
- this.assertInnerHTML('model color: red, controller color: red');
- return this.visit('/colors/green');
- })
- .then(() => {
- this.assertInnerHTML('model color: green, controller color: green');
- });
- }
-
- ['@test it should produce a stable DOM when two routes render the same template']() {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- this.router.map(function () {
- this.route('a');
- this.route('b');
- });
-
- this.add(
- 'route:a',
- Route.extend({
- model() {
- return 'A';
- },
-
- renderTemplate(controller, model) {
- expectDeprecation(
- () => this.render('common', { controller: 'common', model }),
- /Usage of `render` is deprecated/
- );
- },
- })
- );
-
- this.add(
- 'route:b',
- Route.extend({
- model() {
- return 'B';
- },
-
- renderTemplate(controller, model) {
- expectDeprecation(
- () => this.render('common', { controller: 'common', model }),
- /Usage of `render` is deprecated/
- );
- },
- })
- );
-
- this.add(
- 'controller:common',
- Controller.extend({
- prefix: 'common',
- })
- );
-
- this.addTemplate('common', '{{this.prefix}} {{@model}}');
-
- return this.visit('/a')
- .then(() => {
- this.assertInnerHTML('common A');
- this.takeSnapshot();
- return this.visit('/b');
- })
- .then(() => {
- this.assertInnerHTML('common B');
- this.assertInvariants();
- });
- }
-
// Regression test, glimmer child outlets tried to assume the first element.
// but the if put-args clobbered the args used by did-create-element.
// I wish there was a way to assert that the OutletComponentManager did not
| true |
Other
|
emberjs
|
ember.js
|
8547049f81ec0f0928bc5786e9687f86f0f54f1a.json
|
Remove renderTemplate, disconnectOutlet, render
Removing these features also effectively removes support for named
outlets.
|
packages/@ember/-internals/routing/lib/system/route.ts
|
@@ -1137,20 +1137,7 @@ class Route extends EmberObject.extend(ActionHandler, Evented) implements IRoute
this.setupController(controller, context, transition);
if (this._environment.options.shouldRender) {
- deprecate(
- 'Usage of `renderTemplate` is deprecated.',
- this.renderTemplate === Route.prototype.renderTemplate,
- {
- id: 'route-render-template',
- until: '4.0.0',
- url: 'https://deprecations.emberjs.com/v3.x/#toc_route-render-template',
- for: 'ember-source',
- since: {
- enabled: '3.27.0',
- },
- }
- );
- this.renderTemplate(controller, context);
+ this[RENDER]();
}
// Setup can cause changes to QPs which need to be propogated immediately in
@@ -1657,312 +1644,6 @@ class Route extends EmberObject.extend(ActionHandler, Evented) implements IRoute
once(this._router, '_setOutlets');
}
- /**
- A hook you can use to render the template for the current route.
-
- This method is called with the controller for the current route and the
- model supplied by the `model` hook. By default, it renders the route's
- template, configured with the controller for the route.
-
- This method can be overridden to set up and render additional or
- alternative templates.
-
- ```app/routes/posts.js
- import Route from '@ember/routing/route';
-
- export default class PostsRoute extends Route {
- renderTemplate(controller, model) {
- let favController = this.controllerFor('favoritePost');
-
- // Render the `favoritePost` template into
- // the outlet `posts`, and display the `favoritePost`
- // controller.
- this.render('favoritePost', {
- outlet: 'posts',
- controller: favController
- });
- }
- }
- ```
-
- @method renderTemplate
- @param {Object} controller the route's controller
- @param {Object} model the route's model
- @since 1.0.0
- @public
- */
- renderTemplate(_controller: any, _model: {}) {
- // eslint-disable-line no-unused-vars
- this[RENDER]();
- }
-
- /**
- `render` is used to render a template into a region of another template
- (indicated by an `{{outlet}}`). `render` is used both during the entry
- phase of routing (via the `renderTemplate` hook) and later in response to
- user interaction.
-
- For example, given the following minimal router and templates:
-
- ```app/router.js
- // ...
-
- Router.map(function() {
- this.route('photos');
- });
-
- export default Router;
- ```
-
- ```handlebars
- <!-- application.hbs -->
- <div class='something-in-the-app-hbs'>
- {{outlet "anOutletName"}}
- </div>
- ```
-
- ```handlebars
- <!-- photos.hbs -->
- <h1>Photos</h1>
- ```
-
- You can render `photos.hbs` into the `"anOutletName"` outlet of
- `application.hbs` by calling `render`:
-
- ```app/routes/post.js
- import Route from '@ember/routing/route';
-
- export default class PostRoute extends Route {
- renderTemplate() {
- this.render('photos', {
- into: 'application',
- outlet: 'anOutletName'
- })
- }
- }
- ```
-
- `render` additionally allows you to supply which `controller` and
- `model` objects should be loaded and associated with the rendered template.
-
- ```app/routes/posts.js
- import Route from '@ember/routing/route';
-
- export default class PostsRoute extends Route {
- renderTemplate(controller, model) {
- this.render('posts', { // the template to render, referenced by name
- into: 'application', // the template to render into, referenced by name
- outlet: 'anOutletName', // the outlet inside `options.into` to render into.
- controller: 'someControllerName', // the controller to use for this template, referenced by name
- model: model // the model to set on `options.controller`.
- })
- }
- }
- ```
-
- The string values provided for the template name, and controller
- will eventually pass through to the resolver for lookup. See
- Resolver for how these are mapped to JavaScript objects in your
- application. The template to render into needs to be related to either the
- current route or one of its ancestors.
-
- Not all options need to be passed to `render`. Default values will be used
- based on the name of the route specified in the router or the Route's
- `controllerName` and `templateName` properties.
-
- For example:
-
- ```app/router.js
- // ...
-
- Router.map(function() {
- this.route('index');
- this.route('post', { path: '/posts/:post_id' });
- });
-
- export default Router;
- ```
-
- ```app/routes/post.js
- import Route from '@ember/routing/route';
-
- export default class PostRoute extends Route {
- renderTemplate() {
- this.render(); // all defaults apply
- }
- }
- ```
-
- The name of the route, defined by the router, is `post`.
-
- The following equivalent default options will be applied when
- the Route calls `render`:
-
- ```javascript
- this.render('post', { // the template name associated with 'post' Route
- into: 'application', // the parent route to 'post' Route
- outlet: 'main', // {{outlet}} and {{outlet 'main'}} are synonymous,
- controller: 'post', // the controller associated with the 'post' Route
- })
- ```
-
- By default the controller's `model` will be the route's model, so it does not
- need to be passed unless you wish to change which model is being used.
-
- @method render
- @param {String} name the name of the template to render
- @param {Object} [options] the options
- @param {String} [options.into] the template to render into,
- referenced by name. Defaults to the parent template
- @param {String} [options.outlet] the outlet inside `options.into` to render into.
- Defaults to 'main'
- @param {String|Object} [options.controller] the controller to use for this template,
- referenced by name or as a controller instance. Defaults to the Route's paired controller
- @param {Object} [options.model] the model object to set on `options.controller`.
- Defaults to the return value of the Route's model hook
- @since 1.0.0
- @public
- */
- render(name?: string, options?: PartialRenderOptions) {
- deprecate(`Usage of \`render\` is deprecated. Route: \`${this.routeName}\``, false, {
- id: 'route-render-template',
- until: '4.0.0',
- url: 'https://deprecations.emberjs.com/v3.x/#toc_route-render-template',
- for: 'ember-source',
- since: {
- enabled: '3.27.0',
- },
- });
- this[RENDER](name, options);
- }
-
- /**
- Disconnects a view that has been rendered into an outlet.
-
- You may pass any or all of the following options to `disconnectOutlet`:
-
- * `outlet`: the name of the outlet to clear (default: 'main')
- * `parentView`: the name of the view containing the outlet to clear
- (default: the view rendered by the parent route)
-
- Example:
-
- ```app/routes/application.js
- import Route from '@ember/routing/route';
- import { action } from '@ember/object';
-
- export default class ApplicationRoute extends Route {
- @action
- showModal(evt) {
- this.render(evt.modalName, {
- outlet: 'modal',
- into: 'application'
- });
- }
-
- @action
- hideModal() {
- this.disconnectOutlet({
- outlet: 'modal',
- parentView: 'application'
- });
- }
- }
- ```
-
- Alternatively, you can pass the `outlet` name directly as a string.
-
- Example:
-
- ```app/routes/application.js
- import Route from '@ember/routing/route';
- import { action } from '@ember/object';
-
- export default class ApplicationRoute extends Route {
- @action
- showModal(evt) {
- // ...
- }
-
- @action
- hideModal(evt) {
- this.disconnectOutlet('modal');
- }
- }
- ```
-
- @method disconnectOutlet
- @param {Object|String} options the options hash or outlet name
- @since 1.0.0
- @public
- */
- disconnectOutlet(options: string | { outlet: string; parentView?: string }) {
- deprecate('The usage of `disconnectOutlet` is deprecated.', false, {
- id: 'route-disconnect-outlet',
- until: '4.0.0',
- url: 'https://deprecations.emberjs.com/v3.x/#toc_route-disconnect-outlet',
- for: 'ember-source',
- since: {
- enabled: '3.27.0',
- },
- });
- let outletName;
- let parentView;
- if (options) {
- if (typeof options === 'string') {
- outletName = options;
- } else {
- outletName = options.outlet;
- parentView = options.parentView ? options.parentView.replace(/\//g, '.') : undefined;
-
- assert(
- 'You passed undefined as the outlet name.',
- !('outlet' in options && options.outlet === undefined)
- );
- }
- }
-
- outletName = outletName || 'main';
- this._disconnectOutlet(outletName, parentView);
- let routeInfos = this._router._routerMicrolib.currentRouteInfos!;
- for (let i = 0; i < routeInfos.length; i++) {
- // This non-local state munging is sadly necessary to maintain
- // backward compatibility with our existing semantics, which allow
- // any route to disconnectOutlet things originally rendered by any
- // other route. This should all get cut in 2.0.
- routeInfos[i].route!._disconnectOutlet(outletName, parentView);
- }
- }
-
- _disconnectOutlet(outletName: string, parentView: string | undefined) {
- let parent = parentRoute(this) as any;
- if (parent && parentView === parent.routeName) {
- parentView = undefined;
- }
- let connections = ROUTE_CONNECTIONS.get(this);
- for (let i = 0; i < connections.length; i++) {
- let connection = connections[i];
- if (connection.outlet === outletName && connection.into === parentView) {
- // This neuters the disconnected outlet such that it doesn't
- // render anything, but it leaves an entry in the outlet
- // hierarchy so that any existing other renders that target it
- // don't suddenly blow up. They will still stick themselves
- // into its outlets, which won't render anywhere. All of this
- // statefulness should get the machete in 2.0.
- connections[i] = {
- owner: connection.owner,
- into: connection.into,
- outlet: connection.outlet,
- name: connection.name,
- controller: undefined,
- template: undefined,
- model: undefined,
- };
- once(this._router, '_setOutlets');
- }
- }
- }
-
willDestroy() {
this.teardownViews();
}
| true |
Other
|
emberjs
|
ember.js
|
8547049f81ec0f0928bc5786e9687f86f0f54f1a.json
|
Remove renderTemplate, disconnectOutlet, render
Removing these features also effectively removes support for named
outlets.
|
packages/ember-testing/tests/acceptance_test.js
|
@@ -50,7 +50,7 @@ if (!jQueryDisabled) {
this.add(
'route:posts',
Route.extend({
- renderTemplate() {
+ setupController() {
testContext.currentRoute = 'posts';
this._super(...arguments);
},
@@ -72,7 +72,7 @@ if (!jQueryDisabled) {
this.add(
'route:comments',
Route.extend({
- renderTemplate() {
+ setupController() {
testContext.currentRoute = 'comments';
this._super(...arguments);
},
@@ -125,8 +125,7 @@ if (!jQueryDisabled) {
}
[`@test helpers can be chained with then`](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- assert.expect(7);
+ assert.expect(6);
window
.visit('/posts')
@@ -165,8 +164,7 @@ if (!jQueryDisabled) {
}
[`@test helpers can be chained to each other (legacy)`](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- assert.expect(8);
+ assert.expect(7);
window
.visit('/posts')
@@ -194,8 +192,7 @@ if (!jQueryDisabled) {
}
[`@test helpers don't need to be chained`](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- assert.expect(6);
+ assert.expect(5);
window.visit('/posts');
@@ -222,8 +219,7 @@ if (!jQueryDisabled) {
}
[`@test Nested async helpers`](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- assert.expect(6);
+ assert.expect(5);
window.visit('/posts');
@@ -251,8 +247,7 @@ if (!jQueryDisabled) {
}
[`@test Multiple nested async helpers`](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- assert.expect(4);
+ assert.expect(3);
window.visit('/posts');
@@ -275,8 +270,7 @@ if (!jQueryDisabled) {
}
[`@test Helpers nested in thens`](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- assert.expect(6);
+ assert.expect(5);
window.visit('/posts').then(() => {
window.click('a:first', '#comments-link');
@@ -317,8 +311,7 @@ if (!jQueryDisabled) {
}
[`@test Unhandled exceptions are logged via Ember.Test.adapter#exception`](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- assert.expect(3);
+ assert.expect(2);
console.error = () => {}; // eslint-disable-line no-console
let asyncHandled;
@@ -350,8 +343,7 @@ if (!jQueryDisabled) {
[`@test Unhandled exceptions in 'andThen' are logged via Ember.Test.adapter#exception`](
assert
) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- assert.expect(2);
+ assert.expect(1);
console.error = () => {}; // eslint-disable-line no-console
Test.adapter = QUnitAdapter.create({
@@ -372,8 +364,7 @@ if (!jQueryDisabled) {
}
[`@test should not start routing on the root URL when visiting another`](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- assert.expect(5);
+ assert.expect(4);
window.visit('/posts');
@@ -436,8 +427,7 @@ if (!jQueryDisabled) {
}
[`@test visiting a URL that causes another transition should yield the correct URL`](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- assert.expect(3);
+ assert.expect(2);
window.visit('/redirect');
@@ -449,8 +439,7 @@ if (!jQueryDisabled) {
[`@test visiting a URL and then visiting a second URL with a transition should yield the correct URL`](
assert
) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- assert.expect(4);
+ assert.expect(3);
window.visit('/posts');
| true |
Other
|
emberjs
|
ember.js
|
8547049f81ec0f0928bc5786e9687f86f0f54f1a.json
|
Remove renderTemplate, disconnectOutlet, render
Removing these features also effectively removes support for named
outlets.
|
packages/ember/tests/routing/decoupled_basic_test.js
|
@@ -919,7 +919,6 @@ moduleFor(
}
['@test Router accounts for rootURL on page load when using history location'](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
let rootURL = window.location.pathname + '/app';
let postsTemplateRendered = false;
let setHistory;
@@ -962,8 +961,9 @@ moduleFor(
'route:posts',
Route.extend({
model() {},
- renderTemplate() {
+ setupController() {
postsTemplateRendered = true;
+ this._super(...arguments);
},
})
);
| true |
Other
|
emberjs
|
ember.js
|
8547049f81ec0f0928bc5786e9687f86f0f54f1a.json
|
Remove renderTemplate, disconnectOutlet, render
Removing these features also effectively removes support for named
outlets.
|
packages/ember/tests/routing/model_loading_test.js
|
@@ -203,53 +203,6 @@ moduleFor(
});
}
- [`@test The route controller specified via controllerName is used in render`](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- this.router.map(function () {
- this.route('home', { path: '/' });
- });
-
- this.add(
- 'route:home',
- Route.extend({
- controllerName: 'myController',
- renderTemplate() {
- expectDeprecation(
- () => this.render('alternative_home'),
- /Usage of `render` is deprecated/
- );
- },
- })
- );
-
- this.add(
- 'controller:myController',
- Controller.extend({
- myValue: 'foo',
- })
- );
-
- this.addTemplate('alternative_home', '<p>alternative home: {{this.myValue}}</p>');
-
- return this.visit('/').then(() => {
- let homeRoute = this.applicationInstance.lookup('route:home');
- let myController = this.applicationInstance.lookup('controller:myController');
- let text = this.$('p').text();
-
- assert.equal(
- homeRoute.controller,
- myController,
- 'route controller is set by controllerName'
- );
-
- assert.equal(
- text,
- 'alternative home: foo',
- 'The homepage template was rendered with data from the custom controller'
- );
- });
- }
-
[`@test The route controller specified via controllerName is used in render even when a controller with the routeName is available`](
assert
) {
@@ -488,9 +441,7 @@ moduleFor(
}
['@test Nested callbacks are not exited when moving to siblings'](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
let rootSetup = 0;
- let rootRender = 0;
let rootModel = 0;
let rootSerialize = 0;
let menuItem;
@@ -525,10 +476,6 @@ moduleFor(
rootSetup++;
},
- renderTemplate() {
- rootRender++;
- },
-
serialize() {
rootSerialize++;
return this._super(...arguments);
@@ -563,7 +510,6 @@ moduleFor(
'The app is now in the initial state'
);
assert.equal(rootSetup, 1, 'The root setup was triggered');
- assert.equal(rootRender, 1, 'The root render was triggered');
assert.equal(rootSerialize, 0, 'The root serialize was not called');
assert.equal(rootModel, 1, 'The root model was called');
@@ -572,7 +518,6 @@ moduleFor(
return router.transitionTo('special', menuItem).then(function () {
assert.equal(rootSetup, 1, 'The root setup was not triggered again');
- assert.equal(rootRender, 1, 'The root render was not triggered again');
assert.equal(rootSerialize, 0, 'The root serialize was not called');
// TODO: Should this be changed?
| true |
Other
|
emberjs
|
ember.js
|
8547049f81ec0f0928bc5786e9687f86f0f54f1a.json
|
Remove renderTemplate, disconnectOutlet, render
Removing these features also effectively removes support for named
outlets.
|
packages/ember/tests/routing/template_rendering_test.js
|
@@ -2,7 +2,7 @@
import { Route } from '@ember/-internals/routing';
import Controller from '@ember/controller';
import { Object as EmberObject, A as emberA } from '@ember/-internals/runtime';
-import { moduleFor, ApplicationTestCase, getTextOf, runTask } from 'internal-test-helpers';
+import { moduleFor, ApplicationTestCase, getTextOf } from 'internal-test-helpers';
import { run } from '@ember/runloop';
import { Component } from '@ember/-internals/glimmer';
@@ -70,182 +70,6 @@ moduleFor(
await assert.rejects(this.visit('/what-is-this-i-dont-even'), /\/what-is-this-i-dont-even/);
}
- [`@test The Homepage with explicit template name in renderTemplate`](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- this.add(
- 'route:home',
- Route.extend({
- renderTemplate() {
- expectDeprecation(() => this.render('homepage'), /Usage of `render` is deprecated/);
- },
- })
- );
-
- return this.visit('/').then(() => {
- let text = this.$('#troll').text();
- assert.equal(text, 'Megatroll', 'the homepage template was rendered');
- });
- }
-
- async [`@test an alternate template will pull in an alternate controller`](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- this.add(
- 'route:home',
- Route.extend({
- renderTemplate() {
- expectDeprecation(() => this.render('homepage'), /Usage of `render` is deprecated/);
- },
- })
- );
- this.add(
- 'controller:homepage',
- Controller.extend({
- init() {
- this._super(...arguments);
- this.name = 'Comes from homepage';
- },
- })
- );
-
- await this.visit('/');
-
- assert.equal(this.$('p').text(), 'Comes from homepage', 'the homepage template was rendered');
- }
-
- async [`@test An alternate template will pull in an alternate controller instead of controllerName`](
- assert
- ) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- this.add(
- 'route:home',
- Route.extend({
- controllerName: 'foo',
- renderTemplate() {
- expectDeprecation(() => this.render('homepage'), /Usage of `render` is deprecated/);
- },
- })
- );
- this.add(
- 'controller:foo',
- Controller.extend({
- init() {
- this._super(...arguments);
- this.name = 'Comes from foo';
- },
- })
- );
- this.add(
- 'controller:homepage',
- Controller.extend({
- init() {
- this._super(...arguments);
- this.name = 'Comes from homepage';
- },
- })
- );
-
- await this.visit('/');
-
- assert.equal(this.$('p').text(), 'Comes from homepage', 'the homepage template was rendered');
- }
-
- async [`@test The template will pull in an alternate controller via key/value`](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- this.router.map(function () {
- this.route('homepage', { path: '/' });
- });
-
- this.add(
- 'route:homepage',
- Route.extend({
- renderTemplate() {
- expectDeprecation(
- () => this.render({ controller: 'home' }),
- /Usage of `render` is deprecated/
- );
- },
- })
- );
- this.add(
- 'controller:home',
- Controller.extend({
- init() {
- this._super(...arguments);
- this.name = 'Comes from home.';
- },
- })
- );
-
- await this.visit('/');
-
- assert.equal(
- this.$('p').text(),
- 'Comes from home.',
- 'the homepage template was rendered from data from the HomeController'
- );
- }
-
- async [`@test The Homepage with explicit template name in renderTemplate and controller`](
- assert
- ) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- this.add(
- 'controller:home',
- Controller.extend({
- init() {
- this._super(...arguments);
- this.name = 'YES I AM HOME';
- },
- })
- );
- this.add(
- 'route:home',
- Route.extend({
- renderTemplate() {
- expectDeprecation(() => this.render('homepage'), /Usage of `render` is deprecated/);
- },
- })
- );
-
- await this.visit('/');
-
- assert.equal(this.$('p').text(), 'YES I AM HOME', 'The homepage template was rendered');
- }
-
- async [`@test Model passed via renderTemplate model is set as controller's model`](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- this.addTemplate(
- 'bio',
- '<p>Model: {{@model.name}}</p><p>Controller: {{this.model.name}}</p>'
- );
- this.add(
- 'route:home',
- Route.extend({
- renderTemplate() {
- expectDeprecation(() => {
- this.render('bio', {
- model: { name: 'emberjs' },
- });
- }, /Usage of `render` is deprecated/);
- },
- })
- );
-
- await this.visit('/');
-
- let text = this.$('p').text();
-
- assert.ok(
- text.indexOf('Model: emberjs') > -1,
- 'Passed model was available as the `@model` argument'
- );
-
- assert.ok(
- text.indexOf('Controller: emberjs') > -1,
- "Passed model was set as controller's `model` property"
- );
- }
-
['@test render uses templateName from route'](assert) {
this.addTemplate('the_real_home_template', '<p>THIS IS THE REAL HOME</p>');
this.add(
@@ -262,65 +86,8 @@ moduleFor(
});
}
- ['@test defining templateName allows other templates to be rendered'](assert) {
- this.addTemplate('alert', `<div class='alert-box'>Invader!</div>`);
- this.addTemplate('the_real_home_template', `<p>THIS IS THE REAL HOME</p>{{outlet 'alert'}}`);
- this.add(
- 'route:home',
- Route.extend({
- templateName: 'the_real_home_template',
- actions: {
- showAlert() {
- expectDeprecation(() => {
- this.render('alert', {
- into: 'home',
- outlet: 'alert',
- });
- }, /Usage of `render` is deprecated/);
- },
- },
- })
- );
-
- return this.visit('/')
- .then(() => {
- let text = this.$('p').text();
- assert.equal(text, 'THIS IS THE REAL HOME', 'the homepage template was rendered');
-
- return runTask(() => this.appRouter.send('showAlert'));
- })
- .then(() => {
- let text = this.$('.alert-box').text();
-
- assert.equal(text, 'Invader!', 'Template for alert was rendered into the outlet');
- });
- }
-
- ['@test templateName is still used when calling render with no name and options'](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- this.addTemplate('alert', `<div class='alert-box'>Invader!</div>`);
- this.addTemplate('home', `<p>THIS IS THE REAL HOME</p>{{outlet 'alert'}}`);
-
- this.add(
- 'route:home',
- Route.extend({
- templateName: 'alert',
- renderTemplate() {
- expectDeprecation(() => this.render({}), /Usage of `render` is deprecated/);
- },
- })
- );
-
- return this.visit('/').then(() => {
- let text = this.$('.alert-box').text();
-
- assert.equal(text, 'Invader!', 'default templateName was rendered into outlet');
- });
- }
-
['@test Generated names can be customized when providing routes with dot notation'](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- assert.expect(5);
+ assert.expect(4);
this.addTemplate('index', '<div>Index</div>');
this.addTemplate('application', "<h1>Home</h1><div class='main'>{{outlet}}</div>");
@@ -339,7 +106,7 @@ moduleFor(
this.add(
'route:foo',
Route.extend({
- renderTemplate() {
+ setupController() {
assert.ok(true, 'FooBarRoute was called');
return this._super(...arguments);
},
@@ -349,7 +116,7 @@ moduleFor(
this.add(
'route:bar.baz',
Route.extend({
- renderTemplate() {
+ setupController() {
assert.ok(true, 'BarBazRoute was called');
return this._super(...arguments);
},
@@ -407,123 +174,6 @@ moduleFor(
});
}
- ['@test Child routes render into specified template'](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- this.addTemplate('index', '<div>Index</div>');
- this.addTemplate('application', "<h1>Home</h1><div class='main'>{{outlet}}</div>");
- this.addTemplate('top', "<div class='middle'>{{outlet}}</div>");
- this.addTemplate('middle', "<div class='bottom'>{{outlet}}</div>");
- this.addTemplate('middle.bottom', '<p>Bottom!</p>');
-
- this.router.map(function () {
- this.route('top', function () {
- this.route('middle', { resetNamespace: true }, function () {
- this.route('bottom');
- });
- });
- });
-
- this.add(
- 'route:middle.bottom',
- Route.extend({
- renderTemplate() {
- expectDeprecation(
- () => this.render('middle/bottom', { into: 'top' }),
- /Usage of `render` is deprecated/
- );
- },
- })
- );
-
- return this.visit('/top/middle/bottom').then(() => {
- assert.ok(true, '/top/middle/bottom has been handled');
- let rootElement = document.getElementById('qunit-fixture');
- assert.equal(
- rootElement.querySelectorAll('.main .middle .bottom p').length,
- 0,
- 'should not render into the middle template'
- );
- assert.equal(
- getTextOf(rootElement.querySelector('.main .middle > p')),
- 'Bottom!',
- 'The template was rendered into the top template'
- );
- });
- }
-
- ['@test Rendering into specified template with slash notation'](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- this.addTemplate('person.profile', 'profile {{outlet}}');
- this.addTemplate('person.details', 'details!');
-
- this.router.map(function () {
- this.route('home', { path: '/' });
- });
-
- this.add(
- 'route:home',
- Route.extend({
- renderTemplate() {
- expectDeprecation(() => {
- this.render('person/profile');
- this.render('person/details', { into: 'person/profile' });
- }, /Usage of `render` is deprecated/);
- },
- })
- );
-
- return this.visit('/').then(() => {
- let rootElement = document.getElementById('qunit-fixture');
- assert.equal(
- rootElement.textContent.trim(),
- 'profile details!',
- 'The templates were rendered'
- );
- });
- }
-
- ['@test Only use route rendered into main outlet for default into property on child'](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- this.addTemplate('application', "{{outlet 'menu'}}{{outlet}}");
- this.addTemplate('posts', '{{outlet}}');
- this.addTemplate('posts.index', '<p class="posts-index">postsIndex</p>');
- this.addTemplate('posts.menu', '<div class="posts-menu">postsMenu</div>');
-
- this.router.map(function () {
- this.route('posts', function () {});
- });
-
- this.add(
- 'route:posts',
- Route.extend({
- renderTemplate() {
- expectDeprecation(() => {
- this.render();
- this.render('posts/menu', {
- into: 'application',
- outlet: 'menu',
- });
- }, /Usage of `render` is deprecated/);
- },
- })
- );
-
- return this.visit('/posts').then(() => {
- assert.ok(true, '/posts has been handled');
- let rootElement = document.getElementById('qunit-fixture');
- assert.equal(
- getTextOf(rootElement.querySelector('div.posts-menu')),
- 'postsMenu',
- 'The posts/menu template was rendered'
- );
- assert.equal(
- getTextOf(rootElement.querySelector('p.posts-index')),
- 'postsIndex',
- 'The posts/index template was rendered'
- );
- });
- }
-
['@test Application template does not duplicate when re-rendered'](assert) {
this.addTemplate('application', '<h3 class="render-once">I render once</h3>{{outlet}}');
@@ -622,830 +272,33 @@ moduleFor(
assert.equal(insertionCount, 1, 'view should still have inserted only once');
}
- ['@test The template is not re-rendered when two routes present the exact same template & controller'](
- assert
- ) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
+ ['@test {{outlet}} works when created after initial render'](assert) {
+ this.addTemplate('sample', 'Hi{{#if this.showTheThing}}{{outlet}}{{/if}}Bye');
+ this.addTemplate('sample.inner', 'Yay');
+ this.addTemplate('sample.inner2', 'Boo');
this.router.map(function () {
- this.route('first');
- this.route('second');
- this.route('third');
- this.route('fourth');
- });
-
- // Note add a component to test insertion
-
- let insertionCount = 0;
- this.add(
- 'component:x-input',
- Component.extend({
- didInsertElement() {
- insertionCount += 1;
- },
- })
- );
-
- let SharedRoute = Route.extend({
- setupController() {
- this.controllerFor('shared').set('message', 'This is the ' + this.routeName + ' message');
- },
-
- renderTemplate() {
- expectDeprecation(
- () => this.render('shared', { controller: 'shared' }),
- /Usage of `render` is deprecated/
- );
- },
+ this.route('sample', { path: '/' }, function () {
+ this.route('inner', { path: '/' });
+ this.route('inner2', { path: '/2' });
+ });
});
- this.add('route:shared', SharedRoute);
- this.add('route:first', SharedRoute.extend());
- this.add('route:second', SharedRoute.extend());
- this.add('route:third', SharedRoute.extend());
- this.add('route:fourth', SharedRoute.extend());
-
- this.add('controller:shared', Controller.extend());
+ let rootElement;
+ return this.visit('/')
+ .then(() => {
+ rootElement = document.getElementById('qunit-fixture');
+ assert.equal(rootElement.textContent.trim(), 'HiBye', 'initial render');
- this.addTemplate('shared', '<p>{{this.message}}{{x-input}}</p>');
+ run(() => this.applicationInstance.lookup('controller:sample').set('showTheThing', true));
- let rootElement = document.getElementById('qunit-fixture');
- return this.visit('/first')
- .then(() => {
- assert.ok(true, '/first has been handled');
- assert.equal(getTextOf(rootElement.querySelector('p')), 'This is the first message');
- assert.equal(insertionCount, 1, 'expected one assertion');
- return this.visit('/second');
- })
- .then(() => {
- assert.ok(true, '/second has been handled');
- assert.equal(getTextOf(rootElement.querySelector('p')), 'This is the second message');
- assert.equal(insertionCount, 1, 'expected one assertion');
- return run(() => {
- this.applicationInstance
- .lookup('router:main')
- .transitionTo('third')
- .then(
- function () {
- assert.ok(true, 'expected transition');
- },
- function (reason) {
- assert.ok(false, 'unexpected transition failure: ', QUnit.jsDump.parse(reason));
- }
- );
- });
- })
- .then(() => {
- assert.equal(getTextOf(rootElement.querySelector('p')), 'This is the third message');
- assert.equal(insertionCount, 1, 'expected one assertion');
- return this.visit('fourth');
+ assert.equal(rootElement.textContent.trim(), 'HiYayBye', 'second render');
+ return this.visit('/2');
})
.then(() => {
- assert.ok(true, '/fourth has been handled');
- assert.equal(insertionCount, 1, 'expected one assertion');
- assert.equal(getTextOf(rootElement.querySelector('p')), 'This is the fourth message');
+ assert.equal(rootElement.textContent.trim(), 'HiBooBye', 'third render');
});
}
- ['@test Route should tear down multiple outlets'](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- this.addTemplate('application', "{{outlet 'menu'}}{{outlet}}{{outlet 'footer'}}");
- this.addTemplate('posts', '{{outlet}}');
- this.addTemplate('users', 'users');
- this.addTemplate('posts.index', '<p class="posts-index">postsIndex</p>');
- this.addTemplate('posts.menu', '<div class="posts-menu">postsMenu</div>');
- this.addTemplate('posts.footer', '<div class="posts-footer">postsFooter</div>');
-
- this.router.map(function () {
- this.route('posts', function () {});
- this.route('users', function () {});
- });
-
- this.add(
- 'route:posts',
- Route.extend({
- renderTemplate() {
- expectDeprecation(() => {
- this.render('posts/menu', {
- into: 'application',
- outlet: 'menu',
- });
-
- this.render();
-
- this.render('posts/footer', {
- into: 'application',
- outlet: 'footer',
- });
- }, /Usage of `render` is deprecated/);
- },
- })
- );
-
- let rootElement = document.getElementById('qunit-fixture');
- return this.visit('/posts')
- .then(() => {
- assert.ok(true, '/posts has been handled');
- assert.equal(
- getTextOf(rootElement.querySelector('div.posts-menu')),
- 'postsMenu',
- 'The posts/menu template was rendered'
- );
- assert.equal(
- getTextOf(rootElement.querySelector('p.posts-index')),
- 'postsIndex',
- 'The posts/index template was rendered'
- );
- assert.equal(
- getTextOf(rootElement.querySelector('div.posts-footer')),
- 'postsFooter',
- 'The posts/footer template was rendered'
- );
-
- return this.visit('/users');
- })
- .then(() => {
- assert.ok(true, '/users has been handled');
- assert.equal(
- rootElement.querySelector('div.posts-menu'),
- null,
- 'The posts/menu template was removed'
- );
- assert.equal(
- rootElement.querySelector('p.posts-index'),
- null,
- 'The posts/index template was removed'
- );
- assert.equal(
- rootElement.querySelector('div.posts-footer'),
- null,
- 'The posts/footer template was removed'
- );
- });
- }
-
- ['@test Route supports clearing outlet explicitly'](assert) {
- this.addTemplate('application', "{{outlet}}{{outlet 'modal'}}");
- this.addTemplate('posts', '{{outlet}}');
- this.addTemplate('users', 'users');
- this.addTemplate('posts.index', '<div class="posts-index">postsIndex {{outlet}}</div>');
- this.addTemplate('posts.modal', '<div class="posts-modal">postsModal</div>');
- this.addTemplate('posts.extra', '<div class="posts-extra">postsExtra</div>');
-
- this.router.map(function () {
- this.route('posts', function () {});
- this.route('users', function () {});
- });
-
- this.add(
- 'route:posts',
- Route.extend({
- actions: {
- showModal() {
- expectDeprecation(() => {
- this.render('posts/modal', {
- into: 'application',
- outlet: 'modal',
- });
- }, /Usage of `render` is deprecated/);
- },
- hideModal() {
- expectDeprecation(
- () =>
- this.disconnectOutlet({
- outlet: 'modal',
- parentView: 'application',
- }),
- 'The usage of `disconnectOutlet` is deprecated.'
- );
- },
- },
- })
- );
-
- this.add(
- 'route:posts.index',
- Route.extend({
- actions: {
- showExtra() {
- expectDeprecation(() => {
- this.render('posts/extra', {
- into: 'posts/index',
- });
- }, /Usage of `render` is deprecated/);
- },
- hideExtra() {
- expectDeprecation(
- () => this.disconnectOutlet({ parentView: 'posts/index' }),
- 'The usage of `disconnectOutlet` is deprecated.'
- );
- },
- },
- })
- );
-
- let rootElement = document.getElementById('qunit-fixture');
-
- return this.visit('/posts')
- .then(() => {
- let router = this.applicationInstance.lookup('router:main');
-
- assert.equal(
- getTextOf(rootElement.querySelector('div.posts-index')),
- 'postsIndex',
- 'The posts/index template was rendered'
- );
- run(() => router.send('showModal'));
- assert.equal(
- getTextOf(rootElement.querySelector('div.posts-modal')),
- 'postsModal',
- 'The posts/modal template was rendered'
- );
- run(() => router.send('showExtra'));
-
- assert.equal(
- getTextOf(rootElement.querySelector('div.posts-extra')),
- 'postsExtra',
- 'The posts/extra template was rendered'
- );
- run(() => router.send('hideModal'));
-
- assert.equal(
- rootElement.querySelector('div.posts-modal'),
- null,
- 'The posts/modal template was removed'
- );
- run(() => router.send('hideExtra'));
-
- assert.equal(
- rootElement.querySelector('div.posts-extra'),
- null,
- 'The posts/extra template was removed'
- );
- run(function () {
- router.send('showModal');
- });
- assert.equal(
- getTextOf(rootElement.querySelector('div.posts-modal')),
- 'postsModal',
- 'The posts/modal template was rendered'
- );
- run(function () {
- router.send('showExtra');
- });
- assert.equal(
- getTextOf(rootElement.querySelector('div.posts-extra')),
- 'postsExtra',
- 'The posts/extra template was rendered'
- );
- return this.visit('/users');
- })
- .then(() => {
- assert.equal(
- rootElement.querySelector('div.posts-index'),
- null,
- 'The posts/index template was removed'
- );
- assert.equal(
- rootElement.querySelector('div.posts-modal'),
- null,
- 'The posts/modal template was removed'
- );
- assert.equal(
- rootElement.querySelector('div.posts-extra'),
- null,
- 'The posts/extra template was removed'
- );
- });
- }
-
- ['@test Route supports clearing outlet using string parameter'](assert) {
- this.addTemplate('application', "{{outlet}}{{outlet 'modal'}}");
- this.addTemplate('posts', '{{outlet}}');
- this.addTemplate('users', 'users');
- this.addTemplate('posts.index', '<div class="posts-index">postsIndex {{outlet}}</div>');
- this.addTemplate('posts.modal', '<div class="posts-modal">postsModal</div>');
-
- this.router.map(function () {
- this.route('posts', function () {});
- this.route('users', function () {});
- });
-
- this.add(
- 'route:posts',
- Route.extend({
- actions: {
- showModal() {
- expectDeprecation(() => {
- this.render('posts/modal', {
- into: 'application',
- outlet: 'modal',
- });
- }, /Usage of `render` is deprecated/);
- },
- hideModal() {
- expectDeprecation(
- () => this.disconnectOutlet('modal'),
- 'The usage of `disconnectOutlet` is deprecated.'
- );
- },
- },
- })
- );
-
- let rootElement = document.getElementById('qunit-fixture');
- return this.visit('/posts')
- .then(() => {
- let router = this.applicationInstance.lookup('router:main');
- assert.equal(
- getTextOf(rootElement.querySelector('div.posts-index')),
- 'postsIndex',
- 'The posts/index template was rendered'
- );
- run(() => router.send('showModal'));
- assert.equal(
- getTextOf(rootElement.querySelector('div.posts-modal')),
- 'postsModal',
- 'The posts/modal template was rendered'
- );
- run(() => router.send('hideModal'));
- assert.equal(
- rootElement.querySelector('div.posts-modal'),
- null,
- 'The posts/modal template was removed'
- );
- return this.visit('/users');
- })
- .then(() => {
- assert.equal(
- rootElement.querySelector('div.posts-index'),
- null,
- 'The posts/index template was removed'
- );
- assert.equal(
- rootElement.querySelector('div.posts-modal'),
- null,
- 'The posts/modal template was removed'
- );
- });
- }
-
- ['@test Route silently fails when cleaning an outlet from an inactive view'](assert) {
- assert.expect(4); // handleURL
-
- this.addTemplate('application', '{{outlet}}');
- this.addTemplate('posts', "{{outlet 'modal'}}");
- this.addTemplate('modal', 'A Yo.');
-
- this.router.map(function () {
- this.route('posts');
- });
-
- this.add(
- 'route:posts',
- Route.extend({
- actions: {
- hideSelf() {
- expectDeprecation(
- () =>
- this.disconnectOutlet({
- outlet: 'main',
- parentView: 'application',
- }),
- 'The usage of `disconnectOutlet` is deprecated.'
- );
- },
- showModal() {
- expectDeprecation(
- () => this.render('modal', { into: 'posts', outlet: 'modal' }),
- /Usage of `render` is deprecated/
- );
- },
- hideModal() {
- expectDeprecation(
- () => this.disconnectOutlet({ outlet: 'modal', parentView: 'posts' }),
- 'The usage of `disconnectOutlet` is deprecated.'
- );
- },
- },
- })
- );
-
- return this.visit('/posts').then(() => {
- assert.ok(true, '/posts has been handled');
- let router = this.applicationInstance.lookup('router:main');
- run(() => router.send('showModal'));
- run(() => router.send('hideSelf'));
- run(() => router.send('hideModal'));
- });
- }
-
- ['@test Specifying non-existent controller name in route#render throws'](assert) {
- expectDeprecation(
- /(Usage of `renderTemplate` is deprecated|Usage of `render` is deprecated)/
- );
- assert.expect(2);
-
- this.router.map(function () {
- this.route('home', { path: '/' });
- });
-
- this.add(
- 'route:home',
- Route.extend({
- renderTemplate() {
- expectAssertion(() => {
- this.render('homepage', {
- controller: 'stefanpenneristhemanforme',
- });
- }, "You passed `controller: 'stefanpenneristhemanforme'` into the `render` method, but no such controller could be found.");
- },
- })
- );
-
- return this.visit('/');
- }
-
- ['@test {{outlet}} works when created after initial render'](assert) {
- this.addTemplate('sample', 'Hi{{#if this.showTheThing}}{{outlet}}{{/if}}Bye');
- this.addTemplate('sample.inner', 'Yay');
- this.addTemplate('sample.inner2', 'Boo');
- this.router.map(function () {
- this.route('sample', { path: '/' }, function () {
- this.route('inner', { path: '/' });
- this.route('inner2', { path: '/2' });
- });
- });
-
- let rootElement;
- return this.visit('/')
- .then(() => {
- rootElement = document.getElementById('qunit-fixture');
- assert.equal(rootElement.textContent.trim(), 'HiBye', 'initial render');
-
- run(() => this.applicationInstance.lookup('controller:sample').set('showTheThing', true));
-
- assert.equal(rootElement.textContent.trim(), 'HiYayBye', 'second render');
- return this.visit('/2');
- })
- .then(() => {
- assert.equal(rootElement.textContent.trim(), 'HiBooBye', 'third render');
- });
- }
-
- ['@test Can render into a named outlet at the top level'](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- this.addTemplate('application', 'A-{{outlet}}-B-{{outlet "other"}}-C');
- this.addTemplate('modal', 'Hello world');
- this.addTemplate('index', 'The index');
- this.router.map(function () {
- this.route('index', { path: '/' });
- });
- this.add(
- 'route:application',
- Route.extend({
- renderTemplate() {
- expectDeprecation(() => {
- this.render();
- this.render('modal', {
- into: 'application',
- outlet: 'other',
- });
- }, /Usage of `render` is deprecated/);
- },
- })
- );
-
- return this.visit('/').then(() => {
- let rootElement = document.getElementById('qunit-fixture');
- assert.equal(
- rootElement.textContent.trim(),
- 'A-The index-B-Hello world-C',
- 'initial render'
- );
- });
- }
-
- ['@test Can disconnect a named outlet at the top level'](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- this.addTemplate('application', 'A-{{outlet}}-B-{{outlet "other"}}-C');
- this.addTemplate('modal', 'Hello world');
- this.addTemplate('index', 'The index');
- this.router.map(function () {
- this.route('index', { path: '/' });
- });
- this.add(
- 'route:application',
- Route.extend({
- renderTemplate() {
- expectDeprecation(() => {
- this.render();
- this.render('modal', {
- into: 'application',
- outlet: 'other',
- });
- }, /Usage of `render` is deprecated/);
- },
- actions: {
- banish() {
- expectDeprecation(
- () =>
- this.disconnectOutlet({
- parentView: 'application',
- outlet: 'other',
- }),
- 'The usage of `disconnectOutlet` is deprecated.'
- );
- },
- },
- })
- );
-
- return this.visit('/').then(() => {
- let rootElement = document.getElementById('qunit-fixture');
- assert.equal(
- rootElement.textContent.trim(),
- 'A-The index-B-Hello world-C',
- 'initial render'
- );
-
- run(this.applicationInstance.lookup('router:main'), 'send', 'banish');
-
- assert.equal(rootElement.textContent.trim(), 'A-The index-B--C', 'second render');
- });
- }
-
- ['@test Can render into a named outlet at the top level, with empty main outlet'](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- this.addTemplate('application', 'A-{{outlet}}-B-{{outlet "other"}}-C');
- this.addTemplate('modal', 'Hello world');
-
- this.router.map(function () {
- this.route('hasNoTemplate', { path: '/' });
- });
-
- this.add(
- 'route:application',
- Route.extend({
- renderTemplate() {
- expectDeprecation(() => {
- this.render();
- this.render('modal', {
- into: 'application',
- outlet: 'other',
- });
- }, /Usage of `render` is deprecated/);
- },
- })
- );
-
- return this.visit('/').then(() => {
- let rootElement = document.getElementById('qunit-fixture');
- assert.equal(rootElement.textContent.trim(), 'A--B-Hello world-C', 'initial render');
- });
- }
-
- ['@test Can render into a named outlet at the top level, later'](assert) {
- this.addTemplate('application', 'A-{{outlet}}-B-{{outlet "other"}}-C');
- this.addTemplate('modal', 'Hello world');
- this.addTemplate('index', 'The index');
- this.router.map(function () {
- this.route('index', { path: '/' });
- });
- this.add(
- 'route:application',
- Route.extend({
- actions: {
- launch() {
- expectDeprecation(() => {
- this.render('modal', {
- into: 'application',
- outlet: 'other',
- });
- }, /Usage of `render` is deprecated/);
- },
- },
- })
- );
-
- return this.visit('/').then(() => {
- let rootElement = document.getElementById('qunit-fixture');
- assert.equal(rootElement.textContent.trim(), 'A-The index-B--C', 'initial render');
- run(this.applicationInstance.lookup('router:main'), 'send', 'launch');
- assert.equal(
- rootElement.textContent.trim(),
- 'A-The index-B-Hello world-C',
- 'second render'
- );
- });
- }
-
- ["@test Can render routes with no 'main' outlet and their children"](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- this.addTemplate('application', '<div id="application">{{outlet "app"}}</div>');
- this.addTemplate(
- 'app',
- '<div id="app-common">{{outlet "common"}}</div><div id="app-sub">{{outlet "sub"}}</div>'
- );
- this.addTemplate('common', '<div id="common"></div>');
- this.addTemplate('sub', '<div id="sub"></div>');
-
- this.router.map(function () {
- this.route('app', { path: '/app' }, function () {
- this.route('sub', { path: '/sub', resetNamespace: true });
- });
- });
-
- this.add(
- 'route:app',
- Route.extend({
- renderTemplate() {
- expectDeprecation(() => {
- this.render('app', {
- outlet: 'app',
- into: 'application',
- });
- this.render('common', {
- outlet: 'common',
- into: 'app',
- });
- }, /Usage of `render` is deprecated/);
- },
- })
- );
-
- this.add(
- 'route:sub',
- Route.extend({
- renderTemplate() {
- expectDeprecation(() => {
- this.render('sub', {
- outlet: 'sub',
- into: 'app',
- });
- }, /Usage of `render` is deprecated/);
- },
- })
- );
-
- let rootElement;
- return this.visit('/app')
- .then(() => {
- rootElement = document.getElementById('qunit-fixture');
- assert.equal(
- rootElement.querySelectorAll('#app-common #common').length,
- 1,
- 'Finds common while viewing /app'
- );
- return this.visit('/app/sub');
- })
- .then(() => {
- assert.equal(
- rootElement.querySelectorAll('#app-common #common').length,
- 1,
- 'Finds common while viewing /app/sub'
- );
- assert.equal(
- rootElement.querySelectorAll('#app-sub #sub').length,
- 1,
- 'Finds sub while viewing /app/sub'
- );
- });
- }
-
- ['@test Tolerates stacked renders'](assert) {
- this.addTemplate('application', '{{outlet}}{{outlet "modal"}}');
- this.addTemplate('index', 'hi');
- this.addTemplate('layer', 'layer');
- this.router.map(function () {
- this.route('index', { path: '/' });
- });
- this.add(
- 'route:application',
- Route.extend({
- actions: {
- openLayer() {
- expectDeprecation(() => {
- this.render('layer', {
- into: 'application',
- outlet: 'modal',
- });
- }, /Usage of `render` is deprecated/);
- },
- close() {
- expectDeprecation(
- () =>
- this.disconnectOutlet({
- outlet: 'modal',
- parentView: 'application',
- }),
- 'The usage of `disconnectOutlet` is deprecated.'
- );
- },
- },
- })
- );
-
- return this.visit('/').then(() => {
- let rootElement = document.getElementById('qunit-fixture');
- let router = this.applicationInstance.lookup('router:main');
- assert.equal(rootElement.textContent.trim(), 'hi');
- run(router, 'send', 'openLayer');
- assert.equal(rootElement.textContent.trim(), 'hilayer');
- run(router, 'send', 'openLayer');
- assert.equal(rootElement.textContent.trim(), 'hilayer');
- run(router, 'send', 'close');
- assert.equal(rootElement.textContent.trim(), 'hi');
- });
- }
-
- ['@test Renders child into parent with non-default template name'](assert) {
- expectDeprecation('Usage of `renderTemplate` is deprecated.');
- this.addTemplate('application', '<div class="a">{{outlet}}</div>');
- this.addTemplate('exports.root', '<div class="b">{{outlet}}</div>');
- this.addTemplate('exports.index', '<div class="c"></div>');
-
- this.router.map(function () {
- this.route('root', function () {});
- });
-
- this.add(
- 'route:root',
- Route.extend({
- renderTemplate() {
- expectDeprecation(() => this.render('exports/root'), /Usage of `render` is deprecated/);
- },
- })
- );
-
- this.add(
- 'route:root.index',
- Route.extend({
- renderTemplate() {
- expectDeprecation(
- () => this.render('exports/index'),
- /Usage of `render` is deprecated/
- );
- },
- })
- );
-
- return this.visit('/root').then(() => {
- let rootElement = document.getElementById('qunit-fixture');
- assert.equal(rootElement.querySelectorAll('.a .b .c').length, 1);
- });
- }
-
- ["@test Allows any route to disconnectOutlet another route's templates"](assert) {
- this.addTemplate('application', '{{outlet}}{{outlet "modal"}}');
- this.addTemplate('index', 'hi');
- this.addTemplate('layer', 'layer');
- this.router.map(function () {
- this.route('index', { path: '/' });
- });
- this.add(
- 'route:application',
- Route.extend({
- actions: {
- openLayer() {
- expectDeprecation(() => {
- this.render('layer', {
- into: 'application',
- outlet: 'modal',
- });
- }, /Usage of `render` is deprecated/);
- },
- },
- })
- );
- this.add(
- 'route:index',
- Route.extend({
- actions: {
- close() {
- expectDeprecation(
- () =>
- this.disconnectOutlet({
- parentView: 'application',
- outlet: 'modal',
- }),
- 'The usage of `disconnectOutlet` is deprecated.'
- );
- },
- },
- })
- );
-
- return this.visit('/').then(() => {
- let rootElement = document.getElementById('qunit-fixture');
- let router = this.applicationInstance.lookup('router:main');
- assert.equal(rootElement.textContent.trim(), 'hi');
- run(router, 'send', 'openLayer');
- assert.equal(rootElement.textContent.trim(), 'hilayer');
- run(router, 'send', 'close');
- assert.equal(rootElement.textContent.trim(), 'hi');
- });
- }
-
['@test Components inside an outlet have their didInsertElement hook invoked when the route is displayed'](
assert
) {
@@ -1522,44 +375,5 @@ moduleFor(
);
});
}
-
- ['@test Exception if outlet name is undefined in render and disconnectOutlet']() {
- this.add(
- 'route:application',
- Route.extend({
- actions: {
- showModal() {
- expectDeprecation(() => {
- this.render({
- outlet: undefined,
- parentView: 'application',
- });
- }, /Usage of `render` is deprecated/);
- },
- hideModal() {
- expectDeprecation(
- () =>
- this.disconnectOutlet({
- outlet: undefined,
- parentView: 'application',
- }),
- 'The usage of `disconnectOutlet` is deprecated.'
- );
- },
- },
- })
- );
-
- return this.visit('/').then(() => {
- let router = this.applicationInstance.lookup('router:main');
- expectAssertion(() => {
- run(() => router.send('showModal'));
- }, /You passed undefined as the outlet name/);
-
- expectAssertion(() => {
- run(() => router.send('hideModal'));
- }, /You passed undefined as the outlet name/);
- });
- }
}
);
| true |
Other
|
emberjs
|
ember.js
|
8547049f81ec0f0928bc5786e9687f86f0f54f1a.json
|
Remove renderTemplate, disconnectOutlet, render
Removing these features also effectively removes support for named
outlets.
|
tests/docs/expected.js
|
@@ -192,7 +192,6 @@ module.exports = {
'didUpdateAttrs',
'disabled',
'disabledClass',
- 'disconnectOutlet',
'document',
'domReady',
'each-in',
@@ -468,8 +467,6 @@ module.exports = {
'removeObjects',
'removeObserver',
'removeTestHelpers',
- 'render',
- 'renderTemplate',
'reopen',
'reopenClass',
'replace',
| true |
Other
|
emberjs
|
ember.js
|
52a1384a0c8a4cff7cc87d018e19d31188b7507d.json
|
Remove sendAction and string action passing
|
packages/@ember/-internals/glimmer/lib/components/abstract-input.ts
|
@@ -2,8 +2,8 @@ import { tracked } from '@ember/-internals/metal';
import { TargetActionSupport } from '@ember/-internals/runtime';
import { TextSupport } from '@ember/-internals/views';
import { EMBER_MODERNIZED_BUILT_IN_COMPONENTS } from '@ember/canary-features';
-import { assert, deprecate } from '@ember/debug';
-import { JQUERY_INTEGRATION, SEND_ACTION } from '@ember/deprecated-features';
+import { assert } from '@ember/debug';
+import { JQUERY_INTEGRATION } from '@ember/deprecated-features';
import { action } from '@ember/object';
import { isConstRef, isUpdatableRef, Reference, updateRef, valueForRef } from '@glimmer/reference';
import Component from '../component';
@@ -207,86 +207,6 @@ export function handleDeprecatedFeatures(
target: InternalComponentConstructor<AbstractInput>,
attributeBindings: Array<string | [attribute: string, argument: string]>
): void {
- if (SEND_ACTION) {
- let angle = target.toString();
- let { prototype } = target;
-
- interface View {
- send(action: string, ...args: unknown[]): void;
- }
-
- let isView = (target: {}): target is View => {
- return typeof (target as Partial<View>).send === 'function';
- };
-
- let superListenerFor = prototype['listenerFor'];
-
- Object.defineProperty(prototype, 'listenerFor', {
- configurable: true,
- enumerable: false,
- value: function listenerFor(this: AbstractInput, name: string): EventListener {
- const actionName = this.named(name);
-
- if (typeof actionName === 'string') {
- deprecate(
- `Passing actions to components as strings (like \`<${angle} @${name}="${actionName}" />\`) is deprecated. ` +
- `Please use closure actions instead (\`<${angle} @${name}={{action "${actionName}"}} />\`).`,
- false,
- {
- id: 'ember-component.send-action',
- for: 'ember-source',
- since: {},
- until: '4.0.0',
- url: 'https://deprecations.emberjs.com/v3.x#toc_ember-component-send-action',
- }
- );
-
- const { caller } = this;
-
- assert('[BUG] missing caller', caller && typeof caller === 'object');
-
- let listener: Function;
-
- if (isView(caller)) {
- listener = (...args: unknown[]) => caller.send(actionName, ...args);
- } else {
- assert(
- `The action '${actionName}' did not exist on ${caller}`,
- typeof caller[actionName] === 'function'
- );
-
- listener = caller[actionName];
- }
-
- let deprecatedListener = (...args: unknown[]) => {
- deprecate(
- `Passing actions to components as strings (like \`<${angle} @${name}="${actionName}" />\`) is deprecated. ` +
- `Please use closure actions instead (\`<${angle} @${name}={{action "${actionName}"}} />\`).`,
- false,
- {
- id: 'ember-component.send-action',
- for: 'ember-source',
- since: {},
- until: '4.0.0',
- url: 'https://deprecations.emberjs.com/v3.x#toc_ember-component-send-action',
- }
- );
-
- return listener(...args);
- };
-
- if (this.isVirtualEventListener(name, deprecatedListener)) {
- return devirtualize(deprecatedListener);
- } else {
- return deprecatedListener as EventListener;
- }
- } else {
- return superListenerFor.call(this, name);
- }
- },
- });
- }
-
if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) {
let { prototype } = target;
| true |
Other
|
emberjs
|
ember.js
|
52a1384a0c8a4cff7cc87d018e19d31188b7507d.json
|
Remove sendAction and string action passing
|
packages/@ember/-internals/glimmer/lib/helpers/action.ts
|
@@ -95,10 +95,10 @@ export const ACTIONS = new _WeakSet();
Closure actions curry both their scope and any arguments. When invoked, any
additional arguments are added to the already curried list.
- Actions should be invoked using the [sendAction](/ember/release/classes/Component/methods/sendAction?anchor=sendAction)
- method. The first argument to `sendAction` is the action to be called, and
- additional arguments are passed to the action function. This has interesting
- properties combined with currying of arguments. For example:
+ Actions are presented in JavaScript as callbacks, and are
+ invoked like any other JavaScript function.
+
+ For example
```app/components/update-name.js
import Component from '@glimmer/component';
@@ -152,7 +152,7 @@ export const ACTIONS = new _WeakSet();
export default Component.extend({
click() {
// Note that model is not passed, it was curried in the template
- this.sendAction('submit', 'bob');
+ this.submit('bob');
}
});
```
| true |
Other
|
emberjs
|
ember.js
|
52a1384a0c8a4cff7cc87d018e19d31188b7507d.json
|
Remove sendAction and string action passing
|
packages/@ember/-internals/glimmer/tests/integration/components/input-angle-test.js
|
@@ -554,31 +554,6 @@ moduleFor(
// this.assertSelectionRange(8, 8); //NOTE: this fails in IE, the range is 0 -> 0 (TEST_SUITE=sauce)
}
- ['@test [DEPRECATED] sends an action with `<Input @enter="foo" />` when <enter> is pressed'](
- assert
- ) {
- assert.expect(4);
-
- expectDeprecation(() => {
- this.render(`<Input @enter="foo" />`, {
- actions: {
- foo(value, event) {
- assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
- },
- },
- });
- }, 'Passing actions to components as strings (like `<Input @enter="foo" />`) is deprecated. Please use closure actions instead (`<Input @enter={{action "foo"}} />`). (\'-top-level\' @ L1:C0) ');
-
- expectDeprecation(() => {
- this.triggerEvent('keyup', { key: 'Enter' });
- }, 'Passing actions to components as strings (like `<Input @enter="foo" />`) is deprecated. Please use closure actions instead (`<Input @enter={{action "foo"}} />`).');
- }
-
['@test sends an action with `<Input @enter={{action "foo"}} />` when <enter> is pressed'](
assert
) {
@@ -602,31 +577,6 @@ moduleFor(
});
}
- ['@test [DEPRECATED] sends an action with `<Input @key-press="foo" />` is pressed'](assert) {
- assert.expect(4);
-
- expectDeprecation(() => {
- this.render(`<Input @value={{this.value}} @key-press='foo' />`, {
- value: 'initial',
-
- actions: {
- foo(value, event) {
- assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
- },
- },
- });
- }, /Passing actions to components as strings \(like `({{input key-press="foo"}}|<Input @key-press="foo" \/>)`\) is deprecated\.|Passing the `@key-press` argument to <Input> is deprecated\./);
-
- expectDeprecation(() => {
- this.triggerEvent('keypress', { key: 'A' });
- }, /Passing actions to components as strings \(like `({{input key-press="foo"}}|<Input @key-press="foo" \/>)`\) is deprecated\./);
- }
-
['@test sends an action with `<Input @key-press={{action "foo"}} />` is pressed'](assert) {
let triggered = 0;
@@ -727,31 +677,6 @@ moduleFor(
});
}
- ['@test [DEPRECATED] sends an action with `<Input @escape-press="foo" />` when <escape> is pressed'](
- assert
- ) {
- assert.expect(4);
-
- expectDeprecation(() => {
- this.render(`<Input @escape-press='foo' />`, {
- actions: {
- foo(value, event) {
- assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
- },
- },
- });
- }, 'Passing actions to components as strings (like `<Input @escape-press="foo" />`) is deprecated. Please use closure actions instead (`<Input @escape-press={{action "foo"}} />`). (\'-top-level\' @ L1:C0) ');
-
- expectDeprecation(() => {
- this.triggerEvent('keyup', { key: 'Escape' });
- }, 'Passing actions to components as strings (like `<Input @escape-press="foo" />`) is deprecated. Please use closure actions instead (`<Input @escape-press={{action "foo"}} />`).');
- }
-
['@test sends an action with `<Input @escape-press={{action "foo"}} />` when <escape> is pressed'](
assert
) {
@@ -773,31 +698,6 @@ moduleFor(
this.triggerEvent('keyup', { key: 'Escape' });
}
- ['@test [DEPRECATED] sends an action with `<Input @key-down="foo" />` when a key is pressed'](
- assert
- ) {
- assert.expect(4);
-
- expectDeprecation(() => {
- this.render(`<Input @key-down='foo' />`, {
- actions: {
- foo(value, event) {
- assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
- },
- },
- });
- }, /Passing actions to components as strings \(like `({{input key-down="foo"}}|<Input @key-down="foo" \/>)`\) is deprecated\.|Passing the `@key-down` argument to <Input> is deprecated\./);
-
- expectDeprecation(() => {
- this.triggerEvent('keydown', { key: 'A' });
- }, 'Passing actions to components as strings (like `<Input @key-down="foo" />`) is deprecated. Please use closure actions instead (`<Input @key-down={{action "foo"}} />`).');
- }
-
['@test [DEPRECATED] sends an action with `<Input @key-down={{action "foo"}} />` when a key is pressed'](
assert
) {
@@ -828,31 +728,6 @@ moduleFor(
assert.equal(triggered, 1, 'The action was triggered exactly once');
}
- ['@test [DEPRECATED] sends an action with `<Input @key-up="foo" />` when a key is pressed'](
- assert
- ) {
- assert.expect(4);
-
- expectDeprecation(() => {
- this.render(`<Input @key-up='foo' />`, {
- actions: {
- foo(value, event) {
- assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
- },
- },
- });
- }, /Passing actions to components as strings \(like `({{input key-up="foo"}}|<Input @key-up="foo" \/>)`\) is deprecated\.|Passing the `@key-up` argument to <Input> is deprecated\./);
-
- expectDeprecation(() => {
- this.triggerEvent('keyup', { key: 'A' });
- }, 'Passing actions to components as strings (like `<Input @key-up="foo" />`) is deprecated. Please use closure actions instead (`<Input @key-up={{action "foo"}} />`).');
- }
-
['@test [DEPRECATED] sends an action with `<Input @key-up={{action "foo"}} />` when a key is pressed'](
assert
) {
| true |
Other
|
emberjs
|
ember.js
|
52a1384a0c8a4cff7cc87d018e19d31188b7507d.json
|
Remove sendAction and string action passing
|
packages/@ember/-internals/glimmer/tests/integration/components/input-curly-test.js
|
@@ -385,31 +385,6 @@ moduleFor(
// this.assertSelectionRange(8, 8); //NOTE: this fails in IE, the range is 0 -> 0 (TEST_SUITE=sauce)
}
- ['@test [DEPRECATED] sends an action with `{{input enter="foo"}}` when <enter> is pressed'](
- assert
- ) {
- assert.expect(4);
-
- expectDeprecation(() => {
- this.render(`{{input enter='foo'}}`, {
- actions: {
- foo(value, event) {
- assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
- },
- },
- });
- }, 'Passing actions to components as strings (like `{{input enter="foo"}}`) is deprecated. Please use closure actions instead (`{{input enter=(action "foo")}}`). (\'-top-level\' @ L1:C0) ');
-
- expectDeprecation(() => {
- this.triggerEvent('keyup', { key: 'Enter' });
- }, 'Passing actions to components as strings (like `<Input @enter="foo" />`) is deprecated. Please use closure actions instead (`<Input @enter={{action "foo"}} />`).');
- }
-
['@test sends an action with `{{input enter=(action "foo")}}` when <enter> is pressed'](
assert
) {
@@ -433,31 +408,6 @@ moduleFor(
});
}
- ['@test [DEPRECATED] sends an action with `{{input key-press="foo"}}` is pressed'](assert) {
- assert.expect(4);
-
- expectDeprecation(() => {
- this.render(`{{input value=this.value key-press='foo'}}`, {
- value: 'initial',
-
- actions: {
- foo(value, event) {
- assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
- },
- },
- });
- }, /Passing actions to components as strings \(like `({{input key-press="foo"}}|<Input @key-press="foo" \/>)`\) is deprecated\.|Passing the `@key-press` argument to <Input> is deprecated\./);
-
- expectDeprecation(() => {
- this.triggerEvent('keypress', { key: 'A' });
- }, /Passing actions to components as strings \(like `({{input key-press="foo"}}|<Input @key-press="foo" \/>)`\) is deprecated\./);
- }
-
['@test sends an action with `{{input key-press=(action "foo")}}` is pressed'](assert) {
let triggered = 0;
@@ -558,31 +508,6 @@ moduleFor(
});
}
- ['@test [DEPRECATED] sends an action with `{{input escape-press="foo"}}` when <escape> is pressed'](
- assert
- ) {
- assert.expect(4);
-
- expectDeprecation(() => {
- this.render(`{{input escape-press='foo'}}`, {
- actions: {
- foo(value, event) {
- assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
- },
- },
- });
- }, 'Passing actions to components as strings (like `{{input escape-press="foo"}}`) is deprecated. Please use closure actions instead (`{{input escape-press=(action "foo")}}`). (\'-top-level\' @ L1:C0) ');
-
- expectDeprecation(() => {
- this.triggerEvent('keyup', { key: 'Escape' });
- }, 'Passing actions to components as strings (like `<Input @escape-press="foo" />`) is deprecated. Please use closure actions instead (`<Input @escape-press={{action "foo"}} />`).');
- }
-
['@test sends an action with `{{input escape-press=(action "foo")}}` when <escape> is pressed'](
assert
) {
@@ -604,31 +529,6 @@ moduleFor(
this.triggerEvent('keyup', { key: 'Escape' });
}
- ['@test [DEPRECATED] sends an action with `{{input key-down="foo"}}` when a key is pressed'](
- assert
- ) {
- assert.expect(4);
-
- expectDeprecation(() => {
- this.render(`{{input key-down='foo'}}`, {
- actions: {
- foo(value, event) {
- assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
- },
- },
- });
- }, /Passing actions to components as strings \(like `({{input key-down="foo"}}|<Input @key-down="foo" \/>)`\) is deprecated\.|Passing the `@key-down` argument to <Input> is deprecated\./);
-
- expectDeprecation(() => {
- this.triggerEvent('keydown', { key: 'A' });
- }, 'Passing actions to components as strings (like `<Input @key-down="foo" />`) is deprecated. Please use closure actions instead (`<Input @key-down={{action "foo"}} />`).');
- }
-
['@test sends an action with `{{input key-down=(action "foo")}}` when a key is pressed'](
assert
) {
@@ -659,31 +559,6 @@ moduleFor(
assert.equal(triggered, 1, 'The action was triggered exactly once');
}
- ['@test [DEPRECATED] sends an action with `{{input key-up="foo"}}` when a key is pressed'](
- assert
- ) {
- assert.expect(4);
-
- expectDeprecation(() => {
- this.render(`{{input key-up='foo'}}`, {
- actions: {
- foo(value, event) {
- assert.ok(true, 'action was triggered');
- if (jQueryDisabled) {
- assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
- } else {
- assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
- }
- },
- },
- });
- }, /Passing actions to components as strings \(like `({{input key-up="foo"}}|<Input @key-up="foo" \/>)`\) is deprecated\.|Passing the `@key-up` argument to <Input> is deprecated\./);
-
- expectDeprecation(() => {
- this.triggerEvent('keyup', { key: 'A' });
- }, 'Passing actions to components as strings (like `<Input @key-up="foo" />`) is deprecated. Please use closure actions instead (`<Input @key-up={{action "foo"}} />`).');
- }
-
['@test sends an action with `{{input key-up=(action "foo")}}` when a key is pressed'](assert) {
expectDeprecation(
() => {
| true |
Other
|
emberjs
|
ember.js
|
52a1384a0c8a4cff7cc87d018e19d31188b7507d.json
|
Remove sendAction and string action passing
|
packages/@ember/-internals/glimmer/tests/integration/components/target-action-test.js
|
@@ -1,604 +1,11 @@
-import {
- moduleFor,
- RenderingTestCase,
- ApplicationTestCase,
- strip,
- runTask,
-} from 'internal-test-helpers';
+import { moduleFor, RenderingTestCase, runTask } from 'internal-test-helpers';
import { set, Mixin } from '@ember/-internals/metal';
import Controller from '@ember/controller';
import { Object as EmberObject } from '@ember/-internals/runtime';
-import { Route } from '@ember/-internals/routing';
import { Component } from '../../utils/helpers';
-function expectSendActionDeprecation(fn) {
- expectDeprecation(
- fn,
- /You called (.*).sendAction\((.*)\) but Component#sendAction is deprecated. Please use closure actions instead./
- );
-}
-
-moduleFor(
- 'Components test: sendAction',
- class extends RenderingTestCase {
- constructor() {
- super(...arguments);
- this.actionCounts = {};
- this.sendCount = 0;
- this.actionArguments = null;
-
- let self = this;
-
- this.registerComponent('action-delegate', {
- ComponentClass: Component.extend({
- init() {
- this._super();
- self.delegate = this;
- this.name = 'action-delegate';
- },
- }),
- });
- }
-
- renderDelegate(template = '{{action-delegate}}', context = {}) {
- let root = this;
- context = Object.assign(context, {
- send(actionName, ...args) {
- root.sendCount++;
- root.actionCounts[actionName] = root.actionCounts[actionName] || 0;
- root.actionCounts[actionName]++;
- root.actionArguments = args;
- },
- });
- this.render(template, context);
- }
-
- assertSendCount(count) {
- this.assert.equal(this.sendCount, count, `Send was called ${count} time(s)`);
- }
-
- assertNamedSendCount(actionName, count) {
- this.assert.equal(
- this.actionCounts[actionName],
- count,
- `An action named '${actionName}' was sent ${count} times`
- );
- }
-
- assertSentWithArgs(expected, message = 'arguments were sent with the action') {
- this.assert.deepEqual(this.actionArguments, expected, message);
- }
-
- ['@test Calling sendAction on a component without an action defined does nothing']() {
- this.renderDelegate();
-
- expectSendActionDeprecation(() => {
- runTask(() => this.delegate.sendAction());
- });
-
- this.assertSendCount(0);
- }
-
- ['@test Calling sendAction on a component with an action defined calls send on the controller']() {
- this.renderDelegate();
-
- expectSendActionDeprecation(() => {
- runTask(() => {
- set(this.delegate, 'action', 'addItem');
- this.delegate.sendAction();
- });
- });
-
- this.assertSendCount(1);
- this.assertNamedSendCount('addItem', 1);
- }
-
- ['@test Calling sendAction on a component with a function calls the function']() {
- this.assert.expect(2);
-
- this.renderDelegate();
-
- expectSendActionDeprecation(() => {
- runTask(() => {
- set(this.delegate, 'action', () => this.assert.ok(true, 'function is called'));
- this.delegate.sendAction();
- });
- });
- }
-
- ['@test Calling sendAction on a component with a function calls the function with arguments']() {
- this.assert.expect(2);
- let argument = {};
-
- this.renderDelegate();
- expectSendActionDeprecation(() => {
- runTask(() => {
- set(this.delegate, 'action', (actualArgument) => {
- this.assert.deepEqual(argument, actualArgument, 'argument is passed');
- });
- this.delegate.sendAction('action', argument);
- });
- });
- }
-
- // TODO consolidate these next 2 tests
- ['@test Calling sendAction on a component with a reference attr calls the function with arguments']() {
- this.renderDelegate('{{action-delegate playing=this.playing}}', {
- playing: null,
- });
-
- expectSendActionDeprecation(() => {
- runTask(() => this.delegate.sendAction());
- });
-
- this.assertSendCount(0);
-
- runTask(() => {
- set(this.context, 'playing', 'didStartPlaying');
- });
- expectSendActionDeprecation(() => {
- runTask(() => {
- this.delegate.sendAction('playing');
- });
- });
-
- this.assertSendCount(1);
- this.assertNamedSendCount('didStartPlaying', 1);
- }
-
- ['@test Calling sendAction on a component with a {{mut}} attr calls the function with arguments']() {
- this.renderDelegate('{{action-delegate playing=(mut this.playing)}}', {
- playing: null,
- });
-
- expectSendActionDeprecation(() => {
- runTask(() => this.delegate.sendAction('playing'));
- });
-
- this.assertSendCount(0);
-
- runTask(() => this.delegate.attrs.playing.update('didStartPlaying'));
- expectSendActionDeprecation(() => {
- runTask(() => this.delegate.sendAction('playing'));
- });
-
- this.assertSendCount(1);
- this.assertNamedSendCount('didStartPlaying', 1);
- }
-
- ["@test Calling sendAction with a named action uses the component's property as the action name"]() {
- this.renderDelegate();
-
- let component = this.delegate;
- expectSendActionDeprecation(() => {
- runTask(() => {
- set(this.delegate, 'playing', 'didStartPlaying');
- component.sendAction('playing');
- });
- });
-
- this.assertSendCount(1);
- this.assertNamedSendCount('didStartPlaying', 1);
-
- expectSendActionDeprecation(() => {
- runTask(() => component.sendAction('playing'));
- });
-
- this.assertSendCount(2);
- this.assertNamedSendCount('didStartPlaying', 2);
-
- expectSendActionDeprecation(() => {
- runTask(() => {
- set(component, 'action', 'didDoSomeBusiness');
- component.sendAction();
- });
- });
-
- this.assertSendCount(3);
- this.assertNamedSendCount('didDoSomeBusiness', 1);
- }
-
- ['@test Calling sendAction when the action name is not a string raises an exception']() {
- this.renderDelegate();
-
- runTask(() => {
- set(this.delegate, 'action', {});
- set(this.delegate, 'playing', {});
- });
- expectSendActionDeprecation(() => {
- expectAssertion(() => this.delegate.sendAction());
- });
- expectSendActionDeprecation(() => {
- expectAssertion(() => this.delegate.sendAction('playing'));
- });
- }
-
- ['@test Calling sendAction on a component with contexts']() {
- this.renderDelegate();
-
- let testContext = { song: 'She Broke My Ember' };
- let firstContext = { song: 'She Broke My Ember' };
- let secondContext = { song: 'My Achey Breaky Ember' };
-
- expectSendActionDeprecation(() => {
- runTask(() => {
- set(this.delegate, 'playing', 'didStartPlaying');
- this.delegate.sendAction('playing', testContext);
- });
- });
-
- this.assertSendCount(1);
- this.assertNamedSendCount('didStartPlaying', 1);
- this.assertSentWithArgs([testContext], 'context was sent with the action');
-
- expectSendActionDeprecation(() => {
- runTask(() => {
- this.delegate.sendAction('playing', firstContext, secondContext);
- });
- });
-
- this.assertSendCount(2);
- this.assertNamedSendCount('didStartPlaying', 2);
- this.assertSentWithArgs(
- [firstContext, secondContext],
- 'multiple contexts were sent to the action'
- );
- }
-
- ['@test calling sendAction on a component within a block sends to the outer scope GH#14216'](
- assert
- ) {
- let testContext = this;
- // overrides default action-delegate so actions can be added
- this.registerComponent('action-delegate', {
- ComponentClass: Component.extend({
- init() {
- this._super();
- testContext.delegate = this;
- this.name = 'action-delegate';
- },
-
- actions: {
- derp(arg1) {
- assert.ok(true, 'action called on action-delgate');
- assert.equal(arg1, 'something special', 'argument passed through properly');
- },
- },
- }),
-
- template: strip`
- {{#component-a}}
- {{component-b bar="derp"}}
- {{/component-a}}
- `,
- });
-
- this.registerComponent('component-a', {
- ComponentClass: Component.extend({
- init() {
- this._super(...arguments);
- this.name = 'component-a';
- },
- actions: {
- derp() {
- assert.ok(false, 'no! bad scoping!');
- },
- },
- }),
- });
-
- let innerChild;
- this.registerComponent('component-b', {
- ComponentClass: Component.extend({
- init() {
- this._super(...arguments);
- innerChild = this;
- this.name = 'component-b';
- },
- }),
- });
-
- this.renderDelegate();
- expectSendActionDeprecation(() => {
- runTask(() => innerChild.sendAction('bar', 'something special'));
- });
- }
-
- ['@test asserts if called on a destroyed component']() {
- let component;
-
- this.registerComponent('rip-alley', {
- ComponentClass: Component.extend({
- init() {
- this._super();
- component = this;
- },
-
- toString() {
- return 'component:rip-alley';
- },
- }),
- });
-
- this.render('{{#if this.shouldRender}}{{rip-alley}}{{/if}}', {
- shouldRender: true,
- });
-
- runTask(() => {
- set(this.context, 'shouldRender', false);
- });
-
- expectAssertion(() => {
- component.sendAction('trigger-me-dead');
- }, "Attempted to call .sendAction() with the action 'trigger-me-dead' on the destroyed object 'component:rip-alley'.");
- }
- }
-);
-
-moduleFor(
- 'Components test: sendAction to a controller',
- class extends ApplicationTestCase {
- ["@test sendAction should trigger an action on the parent component's controller if it exists"](
- assert
- ) {
- assert.expect(20);
-
- let component;
-
- this.router.map(function () {
- this.route('a');
- this.route('b');
- this.route('c', function () {
- this.route('d');
- this.route('e');
- });
- });
-
- this.addComponent('foo-bar', {
- ComponentClass: Component.extend({
- init() {
- this._super(...arguments);
- component = this;
- },
- }),
- template: `{{this.val}}`,
- });
-
- this.add(
- 'controller:a',
- Controller.extend({
- send(actionName, actionContext) {
- assert.equal(
- actionName,
- 'poke',
- 'send() method was invoked from a top level controller'
- );
- assert.equal(
- actionContext,
- 'top',
- 'action arguments were passed into the top level controller'
- );
- },
- })
- );
- this.addTemplate('a', '{{foo-bar val="a" poke="poke"}}');
-
- this.add(
- 'route:b',
- Route.extend({
- actions: {
- poke(actionContext) {
- assert.ok(true, 'Unhandled action sent to route');
- assert.equal(actionContext, 'top no controller');
- },
- },
- })
- );
- this.addTemplate('b', '{{foo-bar val="b" poke="poke"}}');
-
- this.add(
- 'route:c',
- Route.extend({
- actions: {
- poke(actionContext) {
- assert.ok(true, 'Unhandled action sent to route');
- assert.equal(actionContext, 'top with nested no controller');
- },
- },
- })
- );
- this.addTemplate('c', '{{foo-bar val="c" poke="poke"}}{{outlet}}');
-
- this.add('route:c.d', Route.extend({}));
-
- this.add(
- 'controller:c.d',
- Controller.extend({
- send(actionName, actionContext) {
- assert.equal(actionName, 'poke', 'send() method was invoked from a nested controller');
- assert.equal(
- actionContext,
- 'nested',
- 'action arguments were passed into the nested controller'
- );
- },
- })
- );
- this.addTemplate('c.d', '{{foo-bar val=".d" poke="poke"}}');
-
- this.add(
- 'route:c.e',
- Route.extend({
- actions: {
- poke(actionContext) {
- assert.ok(true, 'Unhandled action sent to route');
- assert.equal(actionContext, 'nested no controller');
- },
- },
- })
- );
- this.addTemplate('c.e', '{{foo-bar val=".e" poke="poke"}}');
-
- return this.visit('/a')
- .then(() => {
- expectSendActionDeprecation(() => component.sendAction('poke', 'top'));
- })
- .then(() => {
- this.assertText('a');
- return this.visit('/b');
- })
- .then(() => {
- expectSendActionDeprecation(() => component.sendAction('poke', 'top no controller'));
- })
- .then(() => {
- this.assertText('b');
- return this.visit('/c');
- })
- .then(() => {
- expectSendActionDeprecation(() => {
- component.sendAction('poke', 'top with nested no controller');
- });
- })
- .then(() => {
- this.assertText('c');
- return this.visit('/c/d');
- })
- .then(() => {
- expectSendActionDeprecation(() => component.sendAction('poke', 'nested'));
- })
- .then(() => {
- this.assertText('c.d');
- return this.visit('/c/e');
- })
- .then(() => {
- expectSendActionDeprecation(() => component.sendAction('poke', 'nested no controller'));
- })
- .then(() => this.assertText('c.e'));
- }
-
- ["@test sendAction should not trigger an action in an outlet's controller if a parent component handles it"](
- assert
- ) {
- assert.expect(2);
-
- let component;
-
- this.addComponent('x-parent', {
- ComponentClass: Component.extend({
- actions: {
- poke() {
- assert.ok(true, 'parent component handled the aciton');
- },
- },
- }),
- template: '{{x-child poke="poke"}}',
- });
-
- this.addComponent('x-child', {
- ComponentClass: Component.extend({
- init() {
- this._super(...arguments);
- component = this;
- },
- }),
- });
-
- this.addTemplate('application', '{{x-parent}}');
- this.add(
- 'controller:application',
- Controller.extend({
- send() {
- throw new Error('controller action should not be called');
- },
- })
- );
-
- return this.visit('/').then(() => {
- expectSendActionDeprecation(() => component.sendAction('poke'));
- });
- }
- }
-);
-
-moduleFor(
- 'Components test: sendAction of a closure action',
- class extends RenderingTestCase {
- ['@test action should be called'](assert) {
- assert.expect(2);
- let component;
-
- this.registerComponent('inner-component', {
- ComponentClass: Component.extend({
- init() {
- this._super(...arguments);
- component = this;
- },
- }),
- template: 'inner',
- });
-
- this.registerComponent('outer-component', {
- ComponentClass: Component.extend({
- outerSubmit() {
- assert.ok(true, 'outerSubmit called');
- },
- }),
- template: '{{inner-component submitAction=(action this.outerSubmit)}}',
- });
-
- this.render('{{outer-component}}');
- expectSendActionDeprecation(() => {
- runTask(() => component.sendAction('submitAction'));
- });
- }
-
- ['@test contexts passed to sendAction are appended to the bound arguments on a closure action']() {
- let first = 'mitch';
- let second = 'martin';
- let third = 'matt';
- let fourth = 'wacky wycats';
-
- let innerComponent;
- let actualArgs;
-
- this.registerComponent('inner-component', {
- ComponentClass: Component.extend({
- init() {
- this._super(...arguments);
- innerComponent = this;
- },
- }),
- template: 'inner',
- });
-
- this.registerComponent('outer-component', {
- ComponentClass: Component.extend({
- third,
- actions: {
- outerSubmit() {
- actualArgs = [...arguments];
- },
- },
- }),
- template: `{{inner-component innerSubmit=(action (action "outerSubmit" "${first}") "${second}" this.third)}}`,
- });
-
- this.render('{{outer-component}}');
- expectSendActionDeprecation(() => {
- runTask(() => innerComponent.sendAction('innerSubmit', fourth));
- });
-
- this.assert.deepEqual(
- actualArgs,
- [first, second, third, fourth],
- 'action has the correct args'
- );
- }
- }
-);
-
moduleFor(
'Components test: send',
class extends RenderingTestCase {
| true |
Other
|
emberjs
|
ember.js
|
52a1384a0c8a4cff7cc87d018e19d31188b7507d.json
|
Remove sendAction and string action passing
|
packages/@ember/-internals/glimmer/tests/integration/helpers/element-action-test.js
|
@@ -1500,17 +1500,15 @@ moduleFor(
let InnerComponent = Component.extend({
click() {
innerClickCalled = true;
- expectDeprecation(() => {
- this.sendAction();
- }, /You called (.*).sendAction\((.*)\) but Component#sendAction is deprecated. Please use closure actions instead./);
+ this.action();
},
});
this.registerComponent('outer-component', {
ComponentClass: OuterComponent,
template: strip`
{{#middle-component}}
- {{inner-component action="hey"}}
+ {{inner-component action=(action "hey")}}
{{/middle-component}}
`,
});
| true |
Other
|
emberjs
|
ember.js
|
52a1384a0c8a4cff7cc87d018e19d31188b7507d.json
|
Remove sendAction and string action passing
|
packages/@ember/-internals/views/lib/mixins/action_support.js
|
@@ -3,9 +3,7 @@
*/
import { inspect } from '@ember/-internals/utils';
import { Mixin, get } from '@ember/-internals/metal';
-import { assert, deprecate } from '@ember/debug';
-import { MUTABLE_CELL } from '../compat/attrs';
-import { SEND_ACTION } from '@ember/deprecated-features';
+import { assert } from '@ember/debug';
const mixinObj = {
send(actionName, ...args) {
@@ -36,155 +34,6 @@ const mixinObj = {
},
};
-if (SEND_ACTION) {
- /**
- Calls an action passed to a component.
-
- For example a component for playing or pausing music may translate click events
- into action notifications of "play" or "stop" depending on some internal state
- of the component:
-
- ```app/components/play-button.js
- import Component from '@ember/component';
-
- export default Component.extend({
- click() {
- if (this.get('isPlaying')) {
- this.sendAction('play');
- } else {
- this.sendAction('stop');
- }
- }
- });
- ```
-
- The actions "play" and "stop" must be passed to this `play-button` component:
-
- ```handlebars
- {{! app/templates/application.hbs }}
- {{play-button play=(action "musicStarted") stop=(action "musicStopped")}}
- ```
-
- When the component receives a browser `click` event it translate this
- interaction into application-specific semantics ("play" or "stop") and
- calls the specified action.
-
- ```app/controller/application.js
- import Controller from '@ember/controller';
-
- export default Controller.extend({
- actions: {
- musicStarted() {
- // called when the play button is clicked
- // and the music started playing
- },
- musicStopped() {
- // called when the play button is clicked
- // and the music stopped playing
- }
- }
- });
- ```
-
- If no action is passed to `sendAction` a default name of "action"
- is assumed.
-
- ```app/components/next-button.js
- import Component from '@ember/component';
-
- export default Component.extend({
- click() {
- this.sendAction();
- }
- });
- ```
-
- ```handlebars
- {{! app/templates/application.hbs }}
- {{next-button action=(action "playNextSongInAlbum")}}
- ```
-
- ```app/controllers/application.js
- import Controller from '@ember/controller';
-
- export default Controller.extend({
- actions: {
- playNextSongInAlbum() {
- ...
- }
- }
- });
- ```
-
- @method sendAction
- @param [action] {String} the action to call
- @param [params] {*} arguments for the action
- @public
- @deprecated
- */
- let sendAction = function sendAction(action, ...contexts) {
- assert(
- `Attempted to call .sendAction() with the action '${action}' on the destroyed object '${this}'.`,
- !this.isDestroying && !this.isDestroyed
- );
- deprecate(
- `You called ${inspect(this)}.sendAction(${
- typeof action === 'string' ? `"${action}"` : ''
- }) but Component#sendAction is deprecated. Please use closure actions instead.`,
- false,
- {
- id: 'ember-component.send-action',
- until: '4.0.0',
- url: 'https://deprecations.emberjs.com/v3.x#toc_ember-component-send-action',
- for: 'ember-source',
- since: {
- enabled: '3.4.0',
- },
- }
- );
-
- let actionName;
-
- // Send the default action
- if (action === undefined) {
- action = 'action';
- }
- actionName = get(this, `attrs.${action}`) || get(this, action);
- actionName = validateAction(this, actionName);
-
- // If no action name for that action could be found, just abort.
- if (actionName === undefined) {
- return;
- }
-
- if (typeof actionName === 'function') {
- actionName(...contexts);
- } else {
- this.triggerAction({
- action: actionName,
- actionContext: contexts,
- });
- }
- };
-
- let validateAction = function validateAction(component, actionName) {
- if (actionName && actionName[MUTABLE_CELL]) {
- actionName = actionName.value;
- }
-
- assert(
- `The default action was triggered on the component ${component.toString()}, but the action name (${actionName}) was not a string.`,
- actionName === null ||
- actionName === undefined ||
- typeof actionName === 'string' ||
- typeof actionName === 'function'
- );
- return actionName;
- };
-
- mixinObj.sendAction = sendAction;
-}
-
/**
@class ActionSupport
@namespace Ember
| true |
Other
|
emberjs
|
ember.js
|
52a1384a0c8a4cff7cc87d018e19d31188b7507d.json
|
Remove sendAction and string action passing
|
packages/@ember/-internals/views/lib/mixins/text_support.js
|
@@ -5,7 +5,6 @@
import { get, set, Mixin } from '@ember/-internals/metal';
import { EMBER_MODERNIZED_BUILT_IN_COMPONENTS } from '@ember/canary-features';
import { deprecate } from '@ember/debug';
-import { SEND_ACTION } from '@ember/deprecated-features';
import { MUTABLE_CELL } from '@ember/-internals/views';
import { DEBUG } from '@glimmer/env';
@@ -327,24 +326,7 @@ function sendAction(eventName, view, event) {
let value = get(view, 'value');
- if (SEND_ACTION && typeof action === 'string') {
- let message = `Passing actions to components as strings (like \`<Input @${eventName}="${action}" />\`) is deprecated. Please use closure actions instead (\`<Input @${eventName}={{action "${action}"}} />\`).`;
-
- deprecate(message, false, {
- id: 'ember-component.send-action',
- until: '4.0.0',
- url: 'https://deprecations.emberjs.com/v3.x#toc_ember-component-send-action',
- for: 'ember-source',
- since: {
- enabled: '3.4.0',
- },
- });
-
- view.triggerAction({
- action: action,
- actionContext: [value, event],
- });
- } else if (typeof action === 'function') {
+ if (typeof action === 'function') {
action(value, event);
}
| true |
Other
|
emberjs
|
ember.js
|
52a1384a0c8a4cff7cc87d018e19d31188b7507d.json
|
Remove sendAction and string action passing
|
packages/@ember/deprecated-features/index.ts
|
@@ -3,7 +3,6 @@
// These versions should be the version that the deprecation was _introduced_,
// not the version that the feature will be removed.
-export const SEND_ACTION = !!'3.4.0';
export const ROUTER_EVENTS = !!'4.0.0';
export const COMPONENT_MANAGER_STRING_LOOKUP = !!'3.8.0';
export const JQUERY_INTEGRATION = !!'3.9.0';
| true |
Other
|
emberjs
|
ember.js
|
52a1384a0c8a4cff7cc87d018e19d31188b7507d.json
|
Remove sendAction and string action passing
|
packages/ember-template-compiler/lib/plugins/deprecate-send-action.ts
|
@@ -1,103 +0,0 @@
-import { deprecate } from '@ember/debug';
-import { SEND_ACTION } from '@ember/deprecated-features';
-import { AST, ASTPlugin } from '@glimmer/syntax';
-import calculateLocationDisplay from '../system/calculate-location-display';
-import { EmberASTPluginEnvironment } from '../types';
-import { isPath } from './utils';
-
-const EVENTS = [
- 'insert-newline',
- 'enter',
- 'escape-press',
- 'focus-in',
- 'focus-out',
- 'key-press',
- 'key-up',
- 'key-down',
-];
-
-export default function deprecateSendAction(env: EmberASTPluginEnvironment): ASTPlugin {
- if (SEND_ACTION) {
- let moduleName = env.meta?.moduleName;
-
- let deprecationMessage = (node: AST.Node, eventName: string, actionName: string) => {
- let sourceInformation = calculateLocationDisplay(moduleName, node.loc);
-
- if (node.type === 'ElementNode') {
- return `Passing actions to components as strings (like \`<Input @${eventName}="${actionName}" />\`) is deprecated. Please use closure actions instead (\`<Input @${eventName}={{action "${actionName}"}} />\`). ${sourceInformation}`;
- } else {
- return `Passing actions to components as strings (like \`{{input ${eventName}="${actionName}"}}\`) is deprecated. Please use closure actions instead (\`{{input ${eventName}=(action "${actionName}")}}\`). ${sourceInformation}`;
- }
- };
-
- return {
- name: 'deprecate-send-action',
-
- visitor: {
- ElementNode(node: AST.ElementNode) {
- if (node.tag !== 'Input') {
- return;
- }
-
- node.attributes.forEach(({ name, value }) => {
- if (name.charAt(0) === '@') {
- let eventName = name.substring(1);
-
- if (EVENTS.indexOf(eventName) > -1) {
- if (value.type === 'TextNode') {
- deprecate(deprecationMessage(node, eventName, value.chars), false, {
- id: 'ember-component.send-action',
- until: '4.0.0',
- url: 'https://deprecations.emberjs.com/v3.x#toc_ember-component-send-action',
- for: 'ember-source',
- since: {
- enabled: '3.4.0',
- },
- });
- } else if (
- value.type === 'MustacheStatement' &&
- value.path.type === 'StringLiteral'
- ) {
- deprecate(deprecationMessage(node, eventName, value.path.original), false, {
- id: 'ember-component.send-action',
- until: '4.0.0',
- url: 'https://deprecations.emberjs.com/v3.x#toc_ember-component-send-action',
- for: 'ember-source',
- since: {
- enabled: '3.4.0',
- },
- });
- }
- }
- }
- });
- },
-
- MustacheStatement(node: AST.MustacheStatement) {
- if (!isPath(node.path) || node.path.original !== 'input') {
- return;
- }
-
- node.hash.pairs.forEach((pair) => {
- if (EVENTS.indexOf(pair.key) > -1 && pair.value.type === 'StringLiteral') {
- deprecate(deprecationMessage(node, pair.key, pair.value.original), false, {
- id: 'ember-component.send-action',
- until: '4.0.0',
- url: 'https://deprecations.emberjs.com/v3.x#toc_ember-component-send-action',
- for: 'ember-source',
- since: {
- enabled: '3.4.0',
- },
- });
- }
- });
- },
- },
- };
- }
-
- return {
- name: 'deprecate-send-action',
- visitor: {},
- };
-}
| true |
Other
|
emberjs
|
ember.js
|
52a1384a0c8a4cff7cc87d018e19d31188b7507d.json
|
Remove sendAction and string action passing
|
packages/ember-template-compiler/lib/plugins/index.ts
|
@@ -3,7 +3,6 @@ import AssertAgainstNamedBlocks from './assert-against-named-blocks';
import AssertInputHelperWithoutBlock from './assert-input-helper-without-block';
import AssertReservedNamedArguments from './assert-reserved-named-arguments';
import AssertSplattributeExpressions from './assert-splattribute-expression';
-import DeprecateSendAction from './deprecate-send-action';
import TransformActionSyntax from './transform-action-syntax';
import TransformAttrsIntoArgs from './transform-attrs-into-args';
import TransformEachInIntoEach from './transform-each-in-into-each';
@@ -17,7 +16,6 @@ import TransformResolutions from './transform-resolutions';
import TransformWrapMountAndOutlet from './transform-wrap-mount-and-outlet';
import { EMBER_DYNAMIC_HELPERS_AND_MODIFIERS, EMBER_NAMED_BLOCKS } from '@ember/canary-features';
-import { SEND_ACTION } from '@ember/deprecated-features';
// order of plugins is important
export const RESOLUTION_MODE_TRANSFORMS = Object.freeze(
@@ -35,7 +33,6 @@ export const RESOLUTION_MODE_TRANSFORMS = Object.freeze(
AssertSplattributeExpressions,
TransformEachTrackArray,
TransformWrapMountAndOutlet,
- SEND_ACTION ? DeprecateSendAction : null,
!EMBER_NAMED_BLOCKS ? AssertAgainstNamedBlocks : null,
EMBER_DYNAMIC_HELPERS_AND_MODIFIERS
? TransformResolutions
@@ -53,7 +50,6 @@ export const STRICT_MODE_TRANSFORMS = Object.freeze(
AssertSplattributeExpressions,
TransformEachTrackArray,
TransformWrapMountAndOutlet,
- SEND_ACTION ? DeprecateSendAction : null,
!EMBER_NAMED_BLOCKS ? AssertAgainstNamedBlocks : null,
!EMBER_DYNAMIC_HELPERS_AND_MODIFIERS ? AssertAgainstDynamicHelpersModifiers : null,
].filter(notNull)
| true |
Other
|
emberjs
|
ember.js
|
52a1384a0c8a4cff7cc87d018e19d31188b7507d.json
|
Remove sendAction and string action passing
|
packages/ember-template-compiler/tests/plugins/deprecate-send-action-test.js
|
@@ -1,29 +0,0 @@
-import { compile } from '../../index';
-import { moduleFor, AbstractTestCase } from 'internal-test-helpers';
-
-const EVENTS = [
- 'insert-newline',
- 'enter',
- 'escape-press',
- 'focus-in',
- 'focus-out',
- 'key-press',
- 'key-up',
- 'key-down',
-];
-
-class DeprecateSendActionTest extends AbstractTestCase {}
-
-EVENTS.forEach(function (e) {
- DeprecateSendActionTest.prototype[
- `@test Using \`{{input ${e}="actionName"}}\` provides a deprecation`
- ] = function () {
- let expectedMessage = `Passing actions to components as strings (like \`{{input ${e}="foo-bar"}}\`) is deprecated. Please use closure actions instead (\`{{input ${e}=(action "foo-bar")}}\`). ('baz/foo-bar' @ L1:C0) `;
-
- expectDeprecation(() => {
- compile(`{{input ${e}="foo-bar"}}`, { moduleName: 'baz/foo-bar' });
- }, expectedMessage);
- };
-});
-
-moduleFor('ember-template-compiler: deprecate-send-action', DeprecateSendActionTest);
| true |
Other
|
emberjs
|
ember.js
|
52a1384a0c8a4cff7cc87d018e19d31188b7507d.json
|
Remove sendAction and string action passing
|
tests/docs/expected.js
|
@@ -510,7 +510,6 @@ module.exports = {
'schedule',
'scheduleOnce',
'send',
- 'sendAction',
'sendEvent',
'serialize',
'serializeQueryParam',
| true |
Other
|
emberjs
|
ember.js
|
f30bdfdda72d18ac6f0824c342f711a593ec5514.json
|
Remove HAS_NATIVE_PROXY flag
After dropping IE11 support, all supported browsers support proxies natively.
|
packages/@ember/-internals/container/lib/container.ts
|
@@ -1,5 +1,5 @@
import { Factory, LookupOptions, Owner, setOwner } from '@ember/-internals/owner';
-import { dictionary, HAS_NATIVE_PROXY, symbol } from '@ember/-internals/utils';
+import { dictionary, symbol } from '@ember/-internals/utils';
import { assert } from '@ember/debug';
import { DEBUG } from '@glimmer/env';
import Registry, { DebugRegistry, Injection } from './registry';
@@ -234,30 +234,26 @@ if (DEBUG) {
* set on the manager.
*/
function wrapManagerInDeprecationProxy<T, C>(manager: FactoryManager<T, C>): FactoryManager<T, C> {
- if (HAS_NATIVE_PROXY) {
- let validator = {
- set(_obj: T, prop: keyof T) {
- throw new Error(
- `You attempted to set "${prop}" on a factory manager created by container#factoryFor. A factory manager is a read-only construct.`
- );
- },
- };
-
- // Note:
- // We have to proxy access to the manager here so that private property
- // access doesn't cause the above errors to occur.
- let m = manager;
- let proxiedManager = {
- class: m.class,
- create(props?: { [prop: string]: any }) {
- return m.create(props);
- },
- };
-
- return new Proxy(proxiedManager, validator as any) as any;
- }
+ let validator = {
+ set(_obj: T, prop: keyof T) {
+ throw new Error(
+ `You attempted to set "${prop}" on a factory manager created by container#factoryFor. A factory manager is a read-only construct.`
+ );
+ },
+ };
- return manager;
+ // Note:
+ // We have to proxy access to the manager here so that private property
+ // access doesn't cause the above errors to occur.
+ let m = manager;
+ let proxiedManager = {
+ class: m.class,
+ create(props?: { [prop: string]: any }) {
+ return m.create(props);
+ },
+ };
+
+ return new Proxy(proxiedManager, validator as any) as any;
}
function isSingleton(container: Container, fullName: string) {
| true |
Other
|
emberjs
|
ember.js
|
f30bdfdda72d18ac6f0824c342f711a593ec5514.json
|
Remove HAS_NATIVE_PROXY flag
After dropping IE11 support, all supported browsers support proxies natively.
|
packages/@ember/-internals/glimmer/tests/integration/event-dispatcher-test.js
|
@@ -8,7 +8,6 @@ import {
} from '@ember/instrumentation';
import { EMBER_IMPROVED_INSTRUMENTATION } from '@ember/canary-features';
import { jQueryDisabled, jQuery } from '@ember/-internals/views';
-import { HAS_NATIVE_PROXY } from '@ember/-internals/utils';
import { DEBUG } from '@glimmer/env';
let canDataTransfer = Boolean(document.createEvent('HTMLEvents').dataTransfer);
@@ -749,9 +748,7 @@ if (jQueryDisabled) {
assert.ok(receivedEvent instanceof jQuery.Event, 'event is a jQuery.Event');
}
- [`@${HAS_NATIVE_PROXY ? 'test' : 'skip'} accessing jQuery.Event#originalEvent is deprecated`](
- assert
- ) {
+ ['@test accessing jQuery.Event#originalEvent is deprecated'](assert) {
let receivedEvent;
this.registerComponent('x-foo', {
@@ -823,7 +820,7 @@ if (jQueryDisabled) {
}
[`@${
- HAS_NATIVE_PROXY && DEBUG ? 'test' : 'skip'
+ DEBUG ? 'test' : 'skip'
} accessing jQuery.Event#__originalEvent does not trigger deprecations to support ember-jquery-legacy`](
assert
) {
| true |
Other
|
emberjs
|
ember.js
|
f30bdfdda72d18ac6f0824c342f711a593ec5514.json
|
Remove HAS_NATIVE_PROXY flag
After dropping IE11 support, all supported browsers support proxies natively.
|
packages/@ember/-internals/glimmer/tests/integration/helpers/fn-test.js
|
@@ -1,5 +1,4 @@
import { set } from '@ember/-internals/metal';
-import { HAS_NATIVE_PROXY } from '@ember/-internals/utils';
import { DEBUG } from '@glimmer/env';
import { RenderingTestCase, moduleFor, runTask } from 'internal-test-helpers';
import { Component } from '../../utils/helpers';
@@ -121,7 +120,7 @@ moduleFor(
}
'@test there is no `this` context within the callback'(assert) {
- if (DEBUG && HAS_NATIVE_PROXY) {
+ if (DEBUG) {
assert.expect(0);
return;
}
| true |
Other
|
emberjs
|
ember.js
|
f30bdfdda72d18ac6f0824c342f711a593ec5514.json
|
Remove HAS_NATIVE_PROXY flag
After dropping IE11 support, all supported browsers support proxies natively.
|
packages/@ember/-internals/glimmer/tests/integration/helpers/hash-test.js
|
@@ -3,7 +3,6 @@ import { RenderingTestCase, moduleFor, runTask } from 'internal-test-helpers';
import { Component } from '../../utils/helpers';
import { set, computed } from '@ember/-internals/metal';
-import { HAS_NATIVE_PROXY } from '@ember/-internals/utils';
moduleFor(
'Helpers test: {{hash}}',
@@ -294,13 +293,9 @@ moduleFor(
this.assertText('Chad ');
runTask(() => {
- if (HAS_NATIVE_PROXY) {
- expectDeprecation(() => {
- set(fooBarInstance.hash, 'lastName', 'Hietala');
- }, /You set the '.*' property on a {{hash}} object/);
- } else {
+ expectDeprecation(() => {
set(fooBarInstance.hash, 'lastName', 'Hietala');
- }
+ }, /You set the '.*' property on a {{hash}} object/);
});
this.assertText('Chad Hietala');
| true |
Other
|
emberjs
|
ember.js
|
f30bdfdda72d18ac6f0824c342f711a593ec5514.json
|
Remove HAS_NATIVE_PROXY flag
After dropping IE11 support, all supported browsers support proxies natively.
|
packages/@ember/-internals/metal/lib/property_get.ts
|
@@ -1,7 +1,7 @@
/**
@module @ember/object
*/
-import { HAS_NATIVE_PROXY, isEmberArray, setProxy, symbol } from '@ember/-internals/utils';
+import { isEmberArray, setProxy, symbol } from '@ember/-internals/utils';
import { assert } from '@ember/debug';
import { DEBUG } from '@glimmer/env';
import {
@@ -17,7 +17,7 @@ export const PROXY_CONTENT = symbol('PROXY_CONTENT');
export let getPossibleMandatoryProxyValue: (obj: object, keyName: string) => any;
-if (DEBUG && HAS_NATIVE_PROXY) {
+if (DEBUG) {
getPossibleMandatoryProxyValue = function getPossibleMandatoryProxyValue(obj, keyName): any {
let content = obj[PROXY_CONTENT];
if (content === undefined) {
@@ -106,7 +106,7 @@ export function _getProp(obj: object, keyName: string) {
let value: unknown;
if (isObjectLike) {
- if (DEBUG && HAS_NATIVE_PROXY) {
+ if (DEBUG) {
value = getPossibleMandatoryProxyValue(obj, keyName);
} else {
value = obj[keyName];
| true |
Other
|
emberjs
|
ember.js
|
f30bdfdda72d18ac6f0824c342f711a593ec5514.json
|
Remove HAS_NATIVE_PROXY flag
After dropping IE11 support, all supported browsers support proxies natively.
|
packages/@ember/-internals/metal/lib/property_set.ts
|
@@ -1,9 +1,4 @@
-import {
- HAS_NATIVE_PROXY,
- lookupDescriptor,
- setWithMandatorySetter,
- toString,
-} from '@ember/-internals/utils';
+import { lookupDescriptor, setWithMandatorySetter, toString } from '@ember/-internals/utils';
import { assert } from '@ember/debug';
import EmberError from '@ember/error';
import { DEBUG } from '@glimmer/env';
@@ -80,7 +75,7 @@ export function _setProp(obj: object, keyName: string, value: any) {
}
let currentValue: any;
- if (DEBUG && HAS_NATIVE_PROXY) {
+ if (DEBUG) {
currentValue = getPossibleMandatoryProxyValue(obj, keyName);
} else {
currentValue = obj[keyName];
| true |
Other
|
emberjs
|
ember.js
|
f30bdfdda72d18ac6f0824c342f711a593ec5514.json
|
Remove HAS_NATIVE_PROXY flag
After dropping IE11 support, all supported browsers support proxies natively.
|
packages/@ember/-internals/runtime/lib/mixins/array.js
|
@@ -3,7 +3,7 @@
*/
import { DEBUG } from '@glimmer/env';
import { PROXY_CONTENT } from '@ember/-internals/metal';
-import { setEmberArray, HAS_NATIVE_PROXY } from '@ember/-internals/utils';
+import { setEmberArray } from '@ember/-internals/utils';
import {
get,
set,
@@ -138,7 +138,7 @@ function insertAt(array, index, item) {
*/
export function isArray(_obj) {
let obj = _obj;
- if (DEBUG && HAS_NATIVE_PROXY && typeof _obj === 'object' && _obj !== null) {
+ if (DEBUG && typeof _obj === 'object' && _obj !== null) {
let possibleProxyContent = _obj[PROXY_CONTENT];
if (possibleProxyContent !== undefined) {
obj = possibleProxyContent;
| true |
Other
|
emberjs
|
ember.js
|
f30bdfdda72d18ac6f0824c342f711a593ec5514.json
|
Remove HAS_NATIVE_PROXY flag
After dropping IE11 support, all supported browsers support proxies natively.
|
packages/@ember/-internals/runtime/lib/system/core_object.js
|
@@ -9,7 +9,6 @@ import {
lookupDescriptor,
inspect,
makeArray,
- HAS_NATIVE_PROXY,
isInternalSymbol,
} from '@ember/-internals/utils';
import { meta } from '@ember/-internals/meta';
@@ -317,7 +316,7 @@ class CoreObject {
let self = this;
- if (DEBUG && HAS_NATIVE_PROXY && typeof self.unknownProperty === 'function') {
+ if (DEBUG && typeof self.unknownProperty === 'function') {
let messageFor = (obj, property) => {
return (
`You attempted to access the \`${String(property)}\` property (of ${obj}).\n` +
| true |
Other
|
emberjs
|
ember.js
|
f30bdfdda72d18ac6f0824c342f711a593ec5514.json
|
Remove HAS_NATIVE_PROXY flag
After dropping IE11 support, all supported browsers support proxies natively.
|
packages/@ember/-internals/runtime/tests/system/object_proxy_test.js
|
@@ -1,6 +1,5 @@
import { DEBUG } from '@glimmer/env';
import { addObserver, observer, computed, get, set, removeObserver } from '@ember/-internals/metal';
-import { HAS_NATIVE_PROXY } from '@ember/-internals/utils';
import ObjectProxy from '../../lib/system/object_proxy';
import { moduleFor, AbstractTestCase, runLoopSettled } from 'internal-test-helpers';
@@ -101,7 +100,7 @@ moduleFor(
}
['@test calling a function on the proxy avoids the assertion'](assert) {
- if (DEBUG && HAS_NATIVE_PROXY) {
+ if (DEBUG) {
let proxy = ObjectProxy.extend({
init() {
if (!this.foobar) {
@@ -153,7 +152,7 @@ moduleFor(
}
['@test getting proxied properties with [] should be an error'](assert) {
- if (DEBUG && HAS_NATIVE_PROXY) {
+ if (DEBUG) {
let proxy = ObjectProxy.create({
content: {
foo: 'FOO',
| true |
Other
|
emberjs
|
ember.js
|
f30bdfdda72d18ac6f0824c342f711a593ec5514.json
|
Remove HAS_NATIVE_PROXY flag
After dropping IE11 support, all supported browsers support proxies natively.
|
packages/@ember/-internals/utils/index.ts
|
@@ -28,7 +28,6 @@ export { default as makeArray } from './lib/make-array';
export { getName, setName } from './lib/name';
export { default as toString } from './lib/to-string';
export { isObject } from './lib/spec';
-export { HAS_NATIVE_PROXY } from './lib/proxy-utils';
export { isProxy, setProxy } from './lib/is_proxy';
export { default as Cache } from './lib/cache';
export { EmberArray, setEmberArray, isEmberArray } from './lib/ember-array';
| true |
Other
|
emberjs
|
ember.js
|
f30bdfdda72d18ac6f0824c342f711a593ec5514.json
|
Remove HAS_NATIVE_PROXY flag
After dropping IE11 support, all supported browsers support proxies natively.
|
packages/@ember/-internals/utils/lib/proxy-utils.ts
|
@@ -1 +0,0 @@
-export const HAS_NATIVE_PROXY = typeof Proxy === 'function';
| true |
Other
|
emberjs
|
ember.js
|
f30bdfdda72d18ac6f0824c342f711a593ec5514.json
|
Remove HAS_NATIVE_PROXY flag
After dropping IE11 support, all supported browsers support proxies natively.
|
packages/@ember/-internals/views/lib/system/jquery_event_deprecation.js
|
@@ -1,12 +1,11 @@
/* global Proxy */
import { deprecate } from '@ember/debug';
import { global } from '@ember/-internals/environment';
-import { HAS_NATIVE_PROXY } from '@ember/-internals/utils';
import { DEBUG } from '@glimmer/env';
import { JQUERY_INTEGRATION } from '@ember/deprecated-features';
export default function addJQueryEventDeprecation(jqEvent) {
- if (DEBUG && JQUERY_INTEGRATION && HAS_NATIVE_PROXY) {
+ if (DEBUG && JQUERY_INTEGRATION) {
let boundFunctions = new Map();
// wrap the jQuery event in a Proxy to add the deprecation message for originalEvent, according to RFC#294
| true |
Other
|
emberjs
|
ember.js
|
f61d5ced097fada4b7dfc46431f5247d7eed5e39.json
|
Remove HAS_NATIVE_SYMBOL flag
After dropping IE11 support, all supported browsers support symbols natively.
|
packages/@ember/-internals/container/lib/container.ts
|
@@ -1,5 +1,5 @@
import { Factory, LookupOptions, Owner, setOwner } from '@ember/-internals/owner';
-import { dictionary, HAS_NATIVE_PROXY, HAS_NATIVE_SYMBOL, symbol } from '@ember/-internals/utils';
+import { dictionary, HAS_NATIVE_PROXY, symbol } from '@ember/-internals/utils';
import { assert } from '@ember/debug';
import { DEBUG } from '@glimmer/env';
import Registry, { DebugRegistry, Injection } from './registry';
@@ -551,7 +551,7 @@ class FactoryManager<T, C> {
this.injections = undefined;
setFactoryFor(this, this);
- if (factory && (HAS_NATIVE_SYMBOL || INIT_FACTORY in factory)) {
+ if (factory) {
setFactoryFor(factory, this);
}
}
| true |
Other
|
emberjs
|
ember.js
|
f61d5ced097fada4b7dfc46431f5247d7eed5e39.json
|
Remove HAS_NATIVE_SYMBOL flag
After dropping IE11 support, all supported browsers support symbols natively.
|
packages/@ember/-internals/extension-support/lib/data_adapter.js
|
@@ -2,12 +2,11 @@ import { getOwner } from '@ember/-internals/owner';
import { _backburner } from '@ember/runloop';
import { get } from '@ember/-internals/metal';
import { dasherize } from '@ember/string';
-import { HAS_NATIVE_SYMBOL } from '@ember/-internals/utils';
import { Namespace, Object as EmberObject, A as emberA } from '@ember/-internals/runtime';
import { consumeTag, createCache, getValue, tagFor, untrack } from '@glimmer/validator';
function iterate(arr, fn) {
- if (HAS_NATIVE_SYMBOL && Symbol.iterator in arr) {
+ if (Symbol.iterator in arr) {
for (let item of arr) {
fn(item);
}
| true |
Other
|
emberjs
|
ember.js
|
f61d5ced097fada4b7dfc46431f5247d7eed5e39.json
|
Remove HAS_NATIVE_SYMBOL flag
After dropping IE11 support, all supported browsers support symbols natively.
|
packages/@ember/-internals/glimmer/lib/utils/iterator.ts
|
@@ -1,6 +1,5 @@
import { objectAt } from '@ember/-internals/metal';
-import { _contentFor } from '@ember/-internals/runtime';
-import { EmberArray, HAS_NATIVE_SYMBOL, isEmberArray, isObject } from '@ember/-internals/utils';
+import { EmberArray, isEmberArray, isObject } from '@ember/-internals/utils';
import { Option } from '@glimmer/interfaces';
import { IteratorDelegate } from '@glimmer/reference';
import { consumeTag, isTracking, tagFor } from '@glimmer/validator';
@@ -21,7 +20,7 @@ function toEachInIterator(iterable: unknown) {
if (Array.isArray(iterable) || isEmberArray(iterable)) {
return ObjectIterator.fromIndexable(iterable);
- } else if (HAS_NATIVE_SYMBOL && isNativeIterable<[unknown, unknown]>(iterable)) {
+ } else if (isNativeIterable<[unknown, unknown]>(iterable)) {
return MapLikeNativeIterator.from(iterable);
} else if (hasForEach(iterable)) {
return ObjectIterator.fromForEachable(iterable);
@@ -39,7 +38,7 @@ function toEachIterator(iterable: unknown) {
return ArrayIterator.from(iterable);
} else if (isEmberArray(iterable)) {
return EmberArrayIterator.from(iterable);
- } else if (HAS_NATIVE_SYMBOL && isNativeIterable(iterable)) {
+ } else if (isNativeIterable(iterable)) {
return ArrayLikeNativeIterator.from(iterable);
} else if (hasForEach(iterable)) {
return ArrayIterator.fromForEachable(iterable);
| true |
Other
|
emberjs
|
ember.js
|
f61d5ced097fada4b7dfc46431f5247d7eed5e39.json
|
Remove HAS_NATIVE_SYMBOL flag
After dropping IE11 support, all supported browsers support symbols natively.
|
packages/@ember/-internals/glimmer/tests/integration/components/component-template-test.js
|
@@ -1,8 +1,6 @@
import { DEBUG } from '@glimmer/env';
import { moduleFor, RenderingTestCase, runTask } from 'internal-test-helpers';
-import { HAS_NATIVE_SYMBOL } from '@ember/-internals/utils';
-
import { setComponentTemplate, getComponentTemplate } from '@glimmer/manager';
import { Component, compile } from '../../utils/helpers';
@@ -68,11 +66,9 @@ moduleFor(
setComponentTemplate(compile('foo'), 'foo');
}, /Cannot call `setComponentTemplate` on `foo`/);
- if (HAS_NATIVE_SYMBOL) {
- assert.throws(() => {
- setComponentTemplate(compile('foo'), Symbol('foo'));
- }, /Cannot call `setComponentTemplate` on `Symbol\(foo\)`/);
- }
+ assert.throws(() => {
+ setComponentTemplate(compile('foo'), Symbol('foo'));
+ }, /Cannot call `setComponentTemplate` on `Symbol\(foo\)`/);
}
'@test calling it twice on the same object asserts'(assert) {
| true |
Other
|
emberjs
|
ember.js
|
f61d5ced097fada4b7dfc46431f5247d7eed5e39.json
|
Remove HAS_NATIVE_SYMBOL flag
After dropping IE11 support, all supported browsers support symbols natively.
|
packages/@ember/-internals/glimmer/tests/integration/content-test.js
|
@@ -6,7 +6,6 @@ import { set, computed } from '@ember/-internals/metal';
import { getDebugFunction, setDebugFunction } from '@ember/debug';
import { readOnly } from '@ember/object/computed';
import { Object as EmberObject, ObjectProxy } from '@ember/-internals/runtime';
-import { HAS_NATIVE_SYMBOL } from '@ember/-internals/utils';
import { constructStyleDeprecationMessage } from '@ember/-internals/views';
import { Component, SafeString, htmlSafe } from '../utils/helpers';
@@ -768,12 +767,9 @@ const SharedContentTestCases = new DynamicContentTestGenerator([
let GlimmerContentTestCases = new DynamicContentTestGenerator([
[Object.create(null), EMPTY, 'an object with no toString'],
+ [Symbol('debug'), 'Symbol(debug)', 'a symbol'],
]);
-if (HAS_NATIVE_SYMBOL) {
- GlimmerContentTestCases.cases.push([Symbol('debug'), 'Symbol(debug)', 'a symbol']);
-}
-
applyMixins(DynamicContentTest, SharedContentTestCases, GlimmerContentTestCases);
moduleFor(
| true |
Other
|
emberjs
|
ember.js
|
f61d5ced097fada4b7dfc46431f5247d7eed5e39.json
|
Remove HAS_NATIVE_SYMBOL flag
After dropping IE11 support, all supported browsers support symbols natively.
|
packages/@ember/-internals/glimmer/tests/integration/syntax/each-in-test.js
|
@@ -1,13 +1,12 @@
-import { moduleFor, RenderingTestCase, strip, applyMixins, runTask } from 'internal-test-helpers';
+import { applyMixins, moduleFor, RenderingTestCase, runTask, strip } from 'internal-test-helpers';
import { get, set } from '@ember/-internals/metal';
import { Object as EmberObject, ObjectProxy } from '@ember/-internals/runtime';
-import { HAS_NATIVE_SYMBOL } from '@ember/-internals/utils';
import {
+ FalsyGenerator,
TogglingSyntaxConditionalsTest,
TruthyGenerator,
- FalsyGenerator,
} from '../../utils/shared-conditional-tests';
function EmptyFunction() {}
@@ -677,31 +676,29 @@ moduleFor(
}
);
-if (HAS_NATIVE_SYMBOL) {
- moduleFor(
- 'Syntax test: {{#each-in}} with custom iterables',
- class extends EachInTest {
- createHash(pojo) {
- let ary = Object.keys(pojo).reduce((accum, key) => {
- return accum.concat([[key, pojo[key]]]);
- }, []);
- let iterable = {
- [Symbol.iterator]: () => makeIterator(ary),
- };
- return {
- hash: iterable,
- delegate: {
- updateNestedValue(context, key, innerKey, value) {
- let ary = Array.from(context.hash);
- let target = ary.find(([k]) => k === key)[1];
- set(target, innerKey, value);
- },
+moduleFor(
+ 'Syntax test: {{#each-in}} with custom iterables',
+ class extends EachInTest {
+ createHash(pojo) {
+ let ary = Object.keys(pojo).reduce((accum, key) => {
+ return accum.concat([[key, pojo[key]]]);
+ }, []);
+ let iterable = {
+ [Symbol.iterator]: () => makeIterator(ary),
+ };
+ return {
+ hash: iterable,
+ delegate: {
+ updateNestedValue(context, key, innerKey, value) {
+ let ary = Array.from(context.hash);
+ let target = ary.find(([k]) => k === key)[1];
+ set(target, innerKey, value);
},
- };
- }
+ },
+ };
}
- );
-}
+ }
+);
// Utils
function makeIterator(ary) {
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.