Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade to ember-cli 3.26, add embroider test setup #30

Merged
merged 3 commits into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# misc
/coverage/
!.*
.eslintcache

# ember-try
/.node_modules.ember-try/
Expand Down
28 changes: 14 additions & 14 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,48 @@ module.exports = {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true
}
legacyDecorators: true,
},
},
plugins: [
'ember'
],
plugins: ['ember'],
extends: [
'eslint:recommended',
'plugin:ember/recommended'
'plugin:ember/recommended',
'plugin:prettier/recommended',
],
env: {
browser: true
browser: true,
},
rules: {},
overrides: [
// node files
{
files: [
'.eslintrc.js',
'.prettierrc.js',
'.template-lintrc.js',
'ember-cli-build.js',
'index.js',
'testem.js',
'blueprints/*/index.js',
'config/**/*.js',
'tests/dummy/config/**/*.js'
'tests/dummy/config/**/*.js',
],
excludedFiles: [
'addon/**',
'addon-test-support/**',
'app/**',
'tests/dummy/app/**'
'tests/dummy/app/**',
],
parserOptions: {
sourceType: 'script'
sourceType: 'script',
},
env: {
browser: false,
node: true
node: true,
},
plugins: ['node'],
extends: ['plugin:node/recommended']
}
]
extends: ['plugin:node/recommended'],
},
],
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
/.env*
/.pnp*
/.sass-cache
/.eslintcache
/connect.lock
/coverage/
/libpeerconnection.log
Expand Down
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
/.editorconfig
/.ember-cli
/.env*
/.eslintcache
/.eslintignore
/.eslintrc.js
/.git/
/.gitignore
/.prettierignore
/.prettierrc.js
/.template-lintrc.js
/.travis.yml
/.watchmanconfig
Expand Down
21 changes: 21 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.eslintcache

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
5 changes: 5 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = {
singleQuote: true,
};
2 changes: 1 addition & 1 deletion .template-lintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

module.exports = {
extends: 'octane'
extends: 'octane',
};
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ jobs:
# as well as latest stable release (bonus points to beta/canary)
- env: EMBER_TRY_SCENARIO=ember-lts-3.12
- env: EMBER_TRY_SCENARIO=ember-lts-3.16
- env: EMBER_TRY_SCENARIO=ember-lts-3.20
- env: EMBER_TRY_SCENARIO=ember-release
- env: EMBER_TRY_SCENARIO=ember-beta
- env: EMBER_TRY_SCENARIO=ember-canary
- env: EMBER_TRY_SCENARIO=ember-default-with-jquery
- env: EMBER_TRY_SCENARIO=ember-classic
- env: EMBER_TRY_SCENARIO=embroider-safe
- env: EMBER_TRY_SCENARIO=embroider-optimized

before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH

install:
- yarn install --non-interactive

script:
- node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@

## Linting

* `yarn lint:hbs`
* `yarn lint:js`
* `yarn lint:js --fix`
* `yarn lint`
* `yarn lint:fix`

## Running tests

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Addon that provides gestures as modifiers.
Compatibility
------------------------------------------------------------------------------

* Ember.js v3.12 or above
* Ember.js v3.16 or above
* Ember CLI v2.13 or above
* Node.js v10 or above

Expand Down
16 changes: 13 additions & 3 deletions addon-test-support/create-pointer-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,24 @@ import { assert } from '@ember/debug';
* @param {number} identifier
* @returns {PointerEvent}
*/
export default function createPointerEvent(target, eventType, x, y, identifier = 0, pointerType = 'touch') {
assert('Argument "pointerType" must be one of "touch", "mouse" or "pen".', ['touch', 'mouse', 'pen'].includes(pointerType));
export default function createPointerEvent(
target,
eventType,
x,
y,
identifier = 0,
pointerType = 'touch'
) {
assert(
'Argument "pointerType" must be one of "touch", "mouse" or "pen".',
['touch', 'mouse', 'pen'].includes(pointerType)
);

return new PointerEvent(eventType, {
identifier: identifier || 0,
target,
clientX: x,
clientY: y,
pointerType: [pointerType]
pointerType: [pointerType],
});
}
16 changes: 8 additions & 8 deletions addon-test-support/pan.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function timeout(duration) {
}

function nextTickPromise() {
return new Promise(resolve => {
return new Promise((resolve) => {
setTimeout(resolve);
});
}
Expand All @@ -29,18 +29,18 @@ function getElement(target) {
}
}

function sendEvent(element, type, x, y, pointerType){
function sendEvent(element, type, x, y, pointerType) {
const event = createPointerEvent(element, type, x, y, 0, pointerType);
element.dispatchEvent(event);
}

// currently only horizontal
async function _pan(element, options = {}){
async function _pan(element, options = {}) {
const {
clientTop: top,
clientLeft: left,
clientWidth: width,
clientHeight: height
clientHeight: height,
} = element;

const right = left + width;
Expand All @@ -55,15 +55,15 @@ async function _pan(element, options = {}){
} = options;

const steps = Math.ceil(duration / resolution);
const middleY = top + height/2;
const middleY = top + height / 2;

sendEvent(document, 'pointerdown', startX, middleY, pointerType);
sendEvent(element, 'pointerdown', startX, middleY, pointerType);
for(let i = 1; i < steps; i++){
for (let i = 1; i < steps; i++) {
await timeout(resolution);
const x = isLeft
? startX - (startX - endX)/steps*i
: (endX - startX)/steps * i;
? startX - ((startX - endX) / steps) * i
: ((endX - startX) / steps) * i;
sendEvent(document, 'pointermove', x, middleY, pointerType);
sendEvent(element, 'pointermove', x, middleY, pointerType);
}
Expand Down
Loading