-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update tests and docs to reflect that decorators require Ember 3.10 a…
…nd higher
- Loading branch information
Showing
8 changed files
with
364 additions
and
344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,68 @@ | ||
import { visit } from '@ember/test-helpers'; | ||
import { setupApplicationTest } from 'ember-qunit'; | ||
import { module, test } from 'qunit'; | ||
|
||
import { keyDown, keyUp, keyPress } from 'ember-keyboard/test-support/test-helpers'; | ||
|
||
import { textChanged } from '../helpers/text-changed'; | ||
import { gte } from 'ember-compatibility-helpers'; | ||
|
||
module('Acceptance | ember keyboard | keyboard', function(hooks) { | ||
setupApplicationTest(hooks); | ||
|
||
hooks.beforeEach(async function() { | ||
await visit('/test-scenario/keyboard'); | ||
}); | ||
if (gte('3.10.0')) { | ||
|
||
module('keyDown', function() { | ||
module('Arrow keys', function() { | ||
test('Left is pressed', async function(assert) { | ||
assert.expect(2); | ||
hooks.beforeEach(async function() { | ||
await visit('/test-scenario/keyboard'); | ||
}); | ||
|
||
await textChanged(assert, | ||
() => keyDown('ArrowLeft'), { | ||
selectorName: 'counter-counter', | ||
beforeValue: '0', | ||
afterValue: '-1', | ||
}); | ||
module('keyDown', function() { | ||
module('Arrow keys', function() { | ||
test('Left is pressed', async function(assert) { | ||
assert.expect(2); | ||
|
||
await textChanged(assert, | ||
() => keyDown('ArrowLeft'), { | ||
selectorName: 'counter-counter', | ||
beforeValue: '0', | ||
afterValue: '-1', | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
module('keyUp', function() { | ||
module('Letters are pressed', function() { | ||
module('R is configured to reset the counter', function(hooks) { | ||
hooks.beforeEach(async function() { | ||
await keyDown('ArrowRight'); | ||
module('keyUp', function() { | ||
module('Letters are pressed', function() { | ||
module('R is configured to reset the counter', function(hooks) { | ||
hooks.beforeEach(async function() { | ||
await keyDown('ArrowRight'); | ||
}); | ||
|
||
test('the counter is cleared', async function(assert) { | ||
assert.expect(2); | ||
|
||
await textChanged(assert, | ||
() => keyUp('KeyR'), { | ||
selectorName: 'counter-counter', | ||
beforeValue: '1', | ||
afterValue: '0' | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
test('the counter is cleared', async function(assert) { | ||
module('keyPress', function() { | ||
module('Numbers are pressed', function() { | ||
test('pressing 5 sets the the counter', async function(assert) { | ||
assert.expect(2); | ||
|
||
await textChanged(assert, | ||
() => keyUp('KeyR'), { | ||
() => keyPress('Digit5'), { | ||
selectorName: 'counter-counter', | ||
beforeValue: '1', | ||
afterValue: '0' | ||
beforeValue: '0', | ||
afterValue: '5' | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
module('keyPress', function() { | ||
module('Numbers are pressed', function() { | ||
test('pressing 5 sets the the counter', async function(assert) { | ||
assert.expect(2); | ||
|
||
await textChanged(assert, | ||
() => keyPress('Digit5'), { | ||
selectorName: 'counter-counter', | ||
beforeValue: '0', | ||
afterValue: '5' | ||
}); | ||
}); | ||
}); | ||
}); | ||
} | ||
}); |
Oops, something went wrong.