diff --git a/packages/ember-testing/index.js b/packages/ember-testing/index.js index 3f2b81f97e6..411e756bf72 100644 --- a/packages/ember-testing/index.js +++ b/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 diff --git a/packages/ember-testing/lib/events.js b/packages/ember-testing/lib/events.js deleted file mode 100644 index 48cd654e1c1..00000000000 --- a/packages/ember-testing/lib/events.js +++ /dev/null @@ -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; -} diff --git a/packages/ember-testing/lib/helpers.js b/packages/ember-testing/lib/helpers.js index 24522ac9f48..edf10340e24 100644 --- a/packages/ember-testing/lib/helpers.js +++ b/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); diff --git a/packages/ember-testing/lib/helpers/-is-form-control.js b/packages/ember-testing/lib/helpers/-is-form-control.js deleted file mode 100644 index f1419e44bdc..00000000000 --- a/packages/ember-testing/lib/helpers/-is-form-control.js +++ /dev/null @@ -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; -} diff --git a/packages/ember-testing/lib/helpers/click.js b/packages/ember-testing/lib/helpers/click.js deleted file mode 100644 index c2780821e4a..00000000000 --- a/packages/ember-testing/lib/helpers/click.js +++ /dev/null @@ -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} - @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(); -} diff --git a/packages/ember-testing/lib/helpers/fill_in.js b/packages/ember-testing/lib/helpers/fill_in.js deleted file mode 100644 index c667eac6164..00000000000 --- a/packages/ember-testing/lib/helpers/fill_in.js +++ /dev/null @@ -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', 'you@example.com').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} - @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(); -} diff --git a/packages/ember-testing/lib/helpers/find.js b/packages/ember-testing/lib/helpers/find.js deleted file mode 100644 index 74ffab24d0d..00000000000 --- a/packages/ember-testing/lib/helpers/find.js +++ /dev/null @@ -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; -} diff --git a/packages/ember-testing/lib/helpers/find_with_assert.js b/packages/ember-testing/lib/helpers/find_with_assert.js deleted file mode 100644 index 15863b70d14..00000000000 --- a/packages/ember-testing/lib/helpers/find_with_assert.js +++ /dev/null @@ -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; -} diff --git a/packages/ember-testing/lib/helpers/key_event.js b/packages/ember-testing/lib/helpers/key_event.js deleted file mode 100644 index bed4161a048..00000000000 --- a/packages/ember-testing/lib/helpers/key_event.js +++ /dev/null @@ -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} - @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, - }); -} diff --git a/packages/ember-testing/lib/helpers/trigger_event.js b/packages/ember-testing/lib/helpers/trigger_event.js deleted file mode 100644 index 4b6e0a04f0d..00000000000 --- a/packages/ember-testing/lib/helpers/trigger_event.js +++ /dev/null @@ -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} - @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(); -} diff --git a/packages/ember-testing/lib/setup_for_testing.js b/packages/ember-testing/lib/setup_for_testing.js index 39fea3b120f..91c615d5fdb 100644 --- a/packages/ember-testing/lib/setup_for_testing.js +++ b/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); - } } diff --git a/packages/ember-testing/lib/support.js b/packages/ember-testing/lib/support.js deleted file mode 100644 index a45df0845ca..00000000000 --- a/packages/ember-testing/lib/support.js +++ /dev/null @@ -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', - }); - }); - }); -} diff --git a/packages/ember-testing/tests/acceptance_test.js b/packages/ember-testing/tests/acceptance_test.js deleted file mode 100644 index c8d5f8bb171..00000000000 --- a/packages/ember-testing/tests/acceptance_test.js +++ /dev/null @@ -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', - ` -
- - -
- ` - ); - - this.add( - 'route:comments', - Route.extend({ - setupController() { - testContext.currentRoute = 'comments'; - this._super(...arguments); - }, - }) - ); - - this.addTemplate('comments', `
{{input type="text"}}
`); - - 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); - } - } - ); -} diff --git a/packages/ember-testing/tests/helpers_test.js b/packages/ember-testing/tests/helpers_test.js deleted file mode 100644 index 729fd6da46f..00000000000 --- a/packages/ember-testing/tests/helpers_test.js +++ /dev/null @@ -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}} - - {{x-checkbox type="checkbox"}} - {{textarea}} -
- {{/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', - ` - - ` - ); - - 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', - ` - -
- -
- ` - ); - 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', - ` - - ` - ); - 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', - `
- -
- ` - ); - - 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', - `
- -
'` - ); - - 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', - `` - ); - - 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', - ` - - - ` - ); - - 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', - ` - -
- -
- ` - ); - 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'); - } - } - ); -} diff --git a/packages/ember-testing/tests/integration_test.js b/packages/ember-testing/tests/integration_test.js deleted file mode 100644 index 0256518968c..00000000000 --- a/packages/ember-testing/tests/integration_test.js +++ /dev/null @@ -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', - ` -
- {{#each @model as |person|}} -
{{person.firstName}}
- {{/each}} -
- ` - ); - - 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); - } - } - } -); diff --git a/tests/docs/expected.js b/tests/docs/expected.js index efbb3376ffc..4bda343c9a2 100644 --- a/tests/docs/expected.js +++ b/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', diff --git a/yarn.lock b/yarn.lock index 872fa81464b..5ec8b04f36c 100644 --- a/yarn.lock +++ b/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/compiler@0.79.4": - 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/compiler@0.80.0": + 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/destroyable@0.79.4": - 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/destroyable@0.80.0": + 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/encoder@0.79.4": - version "0.79.4" - resolved "https://registry.yarnpkg.com/@glimmer/encoder/-/encoder-0.79.4.tgz#2e2e7da3f80f21732f7ed0003c391caf4b42acfe" - integrity sha512-qqyW/TWVK1RP/zEVq0NU2EvOViftVyB43BB7y2yVyb+qD3gK0weP1InwPp1tyNUF7B6LHAcd64d4pN29Qj3vHw== +"@glimmer/encoder@0.80.0": + 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/env@0.1.7", "@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/global-context@0.79.4": - 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/global-context@0.80.0": + 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/interfaces@0.79.4": - 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/interfaces@0.80.0": 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/manager@0.79.4": - version "0.79.4" - resolved "https://registry.yarnpkg.com/@glimmer/manager/-/manager-0.79.4.tgz#82cefd85d503c5a3c40389f3c869a8abbf273648" - integrity sha512-SCSrBEdu/JvTEFPvgkDu3kaRgJrJHrhAdB2WAoevNb8bMMhADxRPTVSfYDFL/6+eQtx6krcycVeeaCLjhZ2LNA== +"@glimmer/manager@0.80.0": + 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/node@0.79.4": - 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/node@0.80.0": + 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/opcode-compiler@0.79.4": - 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/opcode-compiler@0.80.0": + 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/owner@0.79.4": - 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/owner@0.80.0": version "0.80.0" @@ -1690,67 +1678,58 @@ dependencies: "@glimmer/util" "0.80.0" -"@glimmer/program@0.79.4": - version "0.79.4" - resolved "https://registry.yarnpkg.com/@glimmer/program/-/program-0.79.4.tgz#80cfda3261388caeeb66ccc46fac469d2e788b71" - integrity sha512-8wvhs7xUTdbAtG+oV19PKSFsyFujnRjl4gPs76Pr7GLHX25XOBhGxL8TptPm0JShxuvB2TMZrBwMGc3rhe402g== +"@glimmer/program@0.80.0": + 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/reference@0.79.4": - 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/reference@0.80.0": + 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/runtime@0.79.4": - version "0.79.4" - resolved "https://registry.yarnpkg.com/@glimmer/runtime/-/runtime-0.79.4.tgz#188044848721f710859c35eecec15293b8c98bba" - integrity sha512-jacyHy7zQ39kR6c4BvPUXpnNDSybnFpFplnhsa0Fr8IqnXRTKqNv1KdfBwdbbPQNaojuV6vyWoh0jPErkcgh0w== +"@glimmer/runtime@0.80.0": + 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/syntax@0.79.4": - version "0.79.4" - resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.79.4.tgz#5aa21d4b3918238c24da3d640abc3b66150fc0c6" - integrity sha512-NiMIoW2G0+sBfLYnvDaZ8o8Ul/3P/ezOT8U7ZvsHDGU5hXM2buFozyoSKLILTvAQ56izdfK9fKCsn0oi4ISx3w== +"@glimmer/syntax@0.80.0": + 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/util@0.79.4": - 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/util@0.80.0": 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/validator@0.79.4": - version "0.79.4" - resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.79.4.tgz#35bc9c6b88d0681b372f1fba3969e6385465b8d7" - integrity sha512-VLT9TozD3n3qwX9hOECn/d2Ig8PTn0Gl1FdiEpb04tldXWY0YL6oSoLEjH97R4KNqvati2jFQOOzyinzu9Ffkw== +"@glimmer/validator@0.80.0": + 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/vm-babel-plugins@0.79.4": - 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/vm-babel-plugins@0.80.0": + 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/vm@0.79.4": - version "0.79.4" - resolved "https://registry.yarnpkg.com/@glimmer/vm/-/vm-0.79.4.tgz#1d0f00909c6b97b99d7c8bb11d1e7b958822dbd3" - integrity sha512-enCXJlypgMTxWUupQWCPUvE41Gh4vsCIWVhqdh6ol+QGzRZBGvfXTz5xu5lTKPJQhFQsTn2ecVTKKVhqMOtzpA== +"@glimmer/vm@0.80.0": + 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/wire-format@0.79.4": - 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/wire-format@0.80.0": + 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 @@ write@1.0.3: 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"