From e50127ac483db0ed75b8d6dfd007f92d12d8f46e Mon Sep 17 00:00:00 2001 From: Ruslan Grabovoy Date: Mon, 13 Nov 2017 23:12:46 +0200 Subject: [PATCH] Rename native-dom to native-events --- .../acceptance-native-dom.js | 24 ------------------ .../acceptance-native-events.js | 25 +++++++++++++++++++ .../integration-native-dom.js | 20 --------------- .../integration-native-events.js | 21 ++++++++++++++++ ...om-context.js => native-events-context.js} | 0 addon/extend.js | 12 ++++----- tests/helpers/module-for-acceptance.js | 12 ++++----- tests/helpers/properties.js | 16 ++++++------ 8 files changed, 66 insertions(+), 64 deletions(-) delete mode 100644 addon/-private/execution_context/acceptance-native-dom.js create mode 100644 addon/-private/execution_context/acceptance-native-events.js delete mode 100644 addon/-private/execution_context/integration-native-dom.js create mode 100644 addon/-private/execution_context/integration-native-events.js rename addon/-private/execution_context/{native-dom-context.js => native-events-context.js} (100%) diff --git a/addon/-private/execution_context/acceptance-native-dom.js b/addon/-private/execution_context/acceptance-native-dom.js deleted file mode 100644 index bf0952ef..00000000 --- a/addon/-private/execution_context/acceptance-native-dom.js +++ /dev/null @@ -1,24 +0,0 @@ -import ExecutionContext from './native-dom-context'; -import wait from 'ember-test-helpers/wait'; - -import { - visit -} from 'ember-native-dom-helpers'; - -export default function AcceptanceExecutionContext(pageObjectNode) { - ExecutionContext.call(this, pageObjectNode); -} - -AcceptanceExecutionContext.prototype = Object.create(ExecutionContext.prototype); - -AcceptanceExecutionContext.prototype.visit = function() { - return visit(...arguments); -}; - -AcceptanceExecutionContext.prototype.runAsync = function(cb) { - (window.wait || wait)().then(() => { - cb(this); - }); - - return this.pageObjectNode; -}; diff --git a/addon/-private/execution_context/acceptance-native-events.js b/addon/-private/execution_context/acceptance-native-events.js new file mode 100644 index 00000000..812aa100 --- /dev/null +++ b/addon/-private/execution_context/acceptance-native-events.js @@ -0,0 +1,25 @@ +import ExecutionContext from './native-events-context'; +import wait from 'ember-test-helpers/wait'; + +import { + visit +} from 'ember-native-dom-helpers'; + +export default function AcceptanceNativeEventsExecutionContext(pageObjectNode) { + ExecutionContext.call(this, pageObjectNode); +} + +AcceptanceNativeEventsExecutionContext.prototype = Object.create(ExecutionContext.prototype); + +AcceptanceNativeEventsExecutionContext.prototype.visit = function() { + return visit(...arguments); +}; + +AcceptanceNativeEventsExecutionContext.prototype.runAsync = function(cb) { + (window.wait || wait)().then(() => { + cb(this); + }); + + return this.pageObjectNode; +}; + diff --git a/addon/-private/execution_context/integration-native-dom.js b/addon/-private/execution_context/integration-native-dom.js deleted file mode 100644 index 9aabdce1..00000000 --- a/addon/-private/execution_context/integration-native-dom.js +++ /dev/null @@ -1,20 +0,0 @@ -import ExecutionContext from './native-dom-context'; - -import Ember from 'ember'; -const { run } = Ember; - -export default function IntegrationExecutionContext(pageObjectNode, testContext) { - ExecutionContext.call(this, pageObjectNode, testContext); -} - -IntegrationExecutionContext.prototype = Object.create(ExecutionContext.prototype); - -IntegrationExecutionContext.prototype.visit = function() {}; - -IntegrationExecutionContext.prototype.runAsync = function(cb) { - run(() => { - cb(this); - }); - - return this.pageObjectNode; -}; diff --git a/addon/-private/execution_context/integration-native-events.js b/addon/-private/execution_context/integration-native-events.js new file mode 100644 index 00000000..4bf50c17 --- /dev/null +++ b/addon/-private/execution_context/integration-native-events.js @@ -0,0 +1,21 @@ +import ExecutionContext from './native-events-context'; + +import Ember from 'ember'; +const { run } = Ember; + +export default function IntegrationNativeEventsExecutionContext(pageObjectNode, testContext) { + ExecutionContext.call(this, pageObjectNode, testContext); +} + +IntegrationNativeEventsExecutionContext.prototype = Object.create(ExecutionContext.prototype); + +IntegrationNativeEventsExecutionContext.prototype.visit = function() {}; + +IntegrationNativeEventsExecutionContext.prototype.runAsync = function(cb) { + run(() => { + cb(this); + }); + + return this.pageObjectNode; +}; + diff --git a/addon/-private/execution_context/native-dom-context.js b/addon/-private/execution_context/native-events-context.js similarity index 100% rename from addon/-private/execution_context/native-dom-context.js rename to addon/-private/execution_context/native-events-context.js diff --git a/addon/extend.js b/addon/extend.js index eb1928a9..fb788ac6 100644 --- a/addon/extend.js +++ b/addon/extend.js @@ -3,19 +3,19 @@ export { findElementWithAssert } from './-private/extend/find-element-with-asser export { buildSelector, getContext, fullScope } from './-private/helpers'; import { register as registerExecutionContext } from './-private/execution_context'; -import IntegrationNativeDOMContext from './-private/execution_context/integration-native-dom'; -import AcceptanceNativeDOMContext from './-private/execution_context/acceptance-native-dom'; +import IntegrationNativeEventsContext from './-private/execution_context/integration-native-events'; +import AcceptanceNativeEventsContext from './-private/execution_context/acceptance-native-events'; import IntegrationEmberContext from './-private/execution_context/integration'; import AcceptanceEmberContext from './-private/execution_context/acceptance'; -function useNativeDOMHelpers(flag = true) { +function useNativeEvents(flag = true) { if (flag) { - registerExecutionContext('integration', IntegrationNativeDOMContext); - registerExecutionContext('acceptance', AcceptanceNativeDOMContext); + registerExecutionContext('integration', IntegrationNativeEventsContext); + registerExecutionContext('acceptance', AcceptanceNativeEventsContext); } else { registerExecutionContext('integration', IntegrationEmberContext); registerExecutionContext('acceptance', AcceptanceEmberContext); } } -export { registerExecutionContext, useNativeDOMHelpers }; +export { registerExecutionContext, useNativeEvents }; diff --git a/tests/helpers/module-for-acceptance.js b/tests/helpers/module-for-acceptance.js index eaa20493..35b0e7fb 100644 --- a/tests/helpers/module-for-acceptance.js +++ b/tests/helpers/module-for-acceptance.js @@ -2,22 +2,22 @@ import { module } from 'qunit'; import Ember from 'ember'; import startApp from '../helpers/start-app'; import destroyApp from '../helpers/destroy-app'; -import { useNativeDOMHelpers } from 'ember-cli-page-object/extend'; +import { useNativeEvents } from 'ember-cli-page-object/extend'; const { RSVP: { Promise } } = Ember; export default function(name, options = {}) { - [false, true].forEach(_useNativeDOMHelpers => { + [false, true].forEach(_useNativeEvents => { let moduleName = name; - if (_useNativeDOMHelpers) { - moduleName += ' [native-dom-helpers]'; + if (_useNativeEvents) { + moduleName += ' [native-events]'; } module(moduleName, { beforeEach() { this.application = startApp(); - useNativeDOMHelpers(_useNativeDOMHelpers); + useNativeEvents(_useNativeEvents); if (options.beforeEach) { return options.beforeEach.apply(this, arguments); @@ -25,7 +25,7 @@ export default function(name, options = {}) { }, afterEach() { - useNativeDOMHelpers(false); + useNativeEvents(false); let afterEach = options.afterEach && options.afterEach.apply(this, arguments); return Promise.resolve(afterEach).then(() => destroyApp(this.application)); diff --git a/tests/helpers/properties.js b/tests/helpers/properties.js index 45785727..21908b28 100644 --- a/tests/helpers/properties.js +++ b/tests/helpers/properties.js @@ -2,29 +2,29 @@ import { AcceptanceAdapter, moduleForAcceptance, testForAcceptance } from './pro import { IntegrationAdapter, moduleForIntegration, testForIntegration } from './properties/integration-adapter'; -import { useNativeDOMHelpers } from 'ember-cli-page-object/extend'; +import { useNativeEvents } from 'ember-cli-page-object/extend'; export function moduleForProperty(name, cbOrOptions, cb) { let options = cb ? cbOrOptions : {}; cb = cb || cbOrOptions; - [true, false].forEach(_useNativeDOMHelpers => { + [true, false].forEach(_useNativeEvents => { // Generate acceptance tests let moduleNamePrefix = 'Acceptance mode '; - if (_useNativeDOMHelpers) { - moduleNamePrefix += ' [native-dom-helpers]'; + if (_useNativeEvents) { + moduleNamePrefix += '[native-events]'; } moduleForAcceptance(`${moduleNamePrefix} | Property | ${name}`, { beforeEach() { - useNativeDOMHelpers(_useNativeDOMHelpers); + useNativeEvents(_useNativeEvents); this.adapter = new AcceptanceAdapter(); }, afterEach() { - useNativeDOMHelpers(false); + useNativeEvents(false); this.adapter.revert(); } }); @@ -38,12 +38,12 @@ export function moduleForProperty(name, cbOrOptions, cb) { moduleForIntegration('html-render', `Integration mode | Property | ${name}`, { integration: true, beforeEach() { - useNativeDOMHelpers(_useNativeDOMHelpers); + useNativeEvents(_useNativeEvents); this.adapter = new IntegrationAdapter(); }, afterEach() { - useNativeDOMHelpers(false); + useNativeEvents(false); this.adapter.revert(); } });