-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1 Alpha 2 ready. Acceptance test have been written. Still need to te…
…st Ctrl-Enter submits. Also need to test before and after closure hooks.
- Loading branch information
Showing
19 changed files
with
162 additions
and
7 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
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { test } from 'qunit'; | ||
import moduleForAcceptance from '../../tests/helpers/module-for-acceptance'; | ||
|
||
moduleForAcceptance('Acceptance | autofocus'); | ||
|
||
test('when autofocus is enabled and focusSelectsText? is also enabled', function (assert) { | ||
visit('/acceptance/autofocus-with-select-text'); | ||
|
||
andThen(function () { | ||
assert.equal(currentURL(), '/acceptance/autofocus-with-select-text'); | ||
assert.equal(document.activeElement.autofocus, true); | ||
assert.equal(window.getSelection().toString(), 'Autofocus This Text'); | ||
}); | ||
}); | ||
|
||
test('when revisiting a template that already had been autofocused', function (assert) { | ||
visit('/acceptance/autofocus-with-select-text'); | ||
|
||
andThen(function () { | ||
assert.equal(currentURL(), '/acceptance/autofocus-with-select-text'); | ||
assert.equal(document.activeElement.autofocus, true); | ||
assert.equal(window.getSelection().toString(), 'Autofocus This Text'); | ||
}); | ||
}); | ||
|
||
test('when autofocus is enabled and focusSelectsText? is disabled', function (assert) { | ||
visit('/acceptance/autofocus-select-text-disabled'); | ||
|
||
andThen(function () { | ||
assert.equal(currentURL(), '/acceptance/autofocus-select-text-disabled'); | ||
assert.equal(document.activeElement.autofocus, true); | ||
assert.equal(window.getSelection().toString(), ''); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* global KeyEvent */ | ||
import { test } from 'qunit'; | ||
import moduleForAcceptance from '../../tests/helpers/module-for-acceptance'; | ||
|
||
moduleForAcceptance('Acceptance | escape clears'); | ||
|
||
test('when escape clears text by default', function (assert) { | ||
visit('/acceptance/escape-clears-text'); | ||
|
||
andThen(function () { | ||
assert.equal(currentURL(), '/acceptance/escape-clears-text'); | ||
assert.equal(find('input.escape-clears-by-default').val(), 'Escape Clears This Text'); | ||
keyEvent('input.escape-clears-by-default', 'keyup', KeyEvent.DOM_VK_ESCAPE); | ||
andThen(() => { | ||
assert.equal(find('input.escape-clears-by-default').val(), ''); | ||
}); | ||
|
||
}); | ||
}); | ||
|
||
test('when escape clears text because escapeKeyClears? was set to true', function (assert) { | ||
visit('/acceptance/escape-clears-text'); | ||
|
||
andThen(function () { | ||
assert.equal(currentURL(), '/acceptance/escape-clears-text'); | ||
assert.equal(find('input.escape-clears-enabled').val(), 'Escape Clears This Text'); | ||
keyEvent('input.escape-clears-enabled', 'keyup', KeyEvent.DOM_VK_ESCAPE); | ||
andThen(() => { | ||
assert.equal(find('input.escape-clears-enabled').val(), ''); | ||
}); | ||
|
||
}); | ||
}); | ||
|
||
test('when escape WILL NOT clear text because escapeKeyClears? was set to false', function (assert) { | ||
visit('/acceptance/escape-clears-text'); | ||
|
||
andThen(function () { | ||
assert.equal(currentURL(), '/acceptance/escape-clears-text'); | ||
assert.equal(find('input.escape-clears-disabled').val(), 'Escape Will Not Clear This Text'); | ||
keyEvent('input.escape-clears-disabled', 'keyup', KeyEvent.DOM_VK_ESCAPE); | ||
andThen(() => { | ||
assert.equal(find('input.escape-clears-disabled').val(), 'Escape Will Not Clear This Text'); | ||
}); | ||
|
||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { test } from 'qunit'; | ||
import moduleForAcceptance from '../../tests/helpers/module-for-acceptance'; | ||
|
||
moduleForAcceptance('Acceptance | focus selects text'); | ||
|
||
test('when focusSelectsText? is false or turned off', function (assert) { | ||
visit('/acceptance/focus-selects-text'); | ||
|
||
andThen(function () { | ||
assert.equal(currentURL(), '/acceptance/focus-selects-text'); | ||
assert.equal(find('input.select-enabled').val(), 'Select This Text'); | ||
assert.equal(window.getSelection().toString(), ''); | ||
triggerEvent('input.select-enabled', 'focus'); | ||
andThen(() => { | ||
assert.equal(window.getSelection().toString(), 'Select This Text'); | ||
}); | ||
}); | ||
}); | ||
|
||
test('when focusSelectsText? is false or turned off', function (assert) { | ||
visit('/acceptance/focus-selects-text'); | ||
|
||
andThen(function () { | ||
assert.equal(currentURL(), '/acceptance/focus-selects-text'); | ||
assert.equal(find('input.select-disabled').val(), 'Text Will Not Select On Focus'); | ||
assert.equal(window.getSelection().toString(), ''); | ||
triggerEvent('input.select-disabled', 'focus'); | ||
andThen(() => { | ||
assert.equal(window.getSelection().toString(), ''); | ||
}); | ||
}); | ||
}); |
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,12 +1,19 @@ | ||
import Ember from 'ember'; | ||
//noinspection JSFileReferences | ||
import config from './config/environment'; | ||
|
||
const Router = Ember.Router.extend({ | ||
location: config.locationType, | ||
rootURL: config.rootURL | ||
}); | ||
|
||
Router.map(function() { | ||
Router.map(function () { | ||
this.route('acceptance', function () { | ||
this.route('focus-selects-text'); | ||
this.route('autofocus-with-select-text'); | ||
this.route('autofocus-select-text-disabled'); | ||
this.route('escape-clears-text'); | ||
}); | ||
}); | ||
|
||
export default Router; |
3 changes: 3 additions & 0 deletions
3
tests/dummy/app/routes/acceptance/autofocus-select-text-disabled.js
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Route.extend({}); |
3 changes: 3 additions & 0 deletions
3
tests/dummy/app/routes/acceptance/autofocus-with-select-text.js
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Route.extend({}); |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Route.extend({}); |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Route.extend({}); |
1 change: 1 addition & 0 deletions
1
tests/dummy/app/templates/acceptance/autofocus-select-text-disabled.hbs
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{{input-text value="Autofocus This Text" autofocus=true focusSelectsText?=false}} |
1 change: 1 addition & 0 deletions
1
tests/dummy/app/templates/acceptance/autofocus-with-select-text.hbs
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{{input-text value="Autofocus This Text" autofocus=true focusSelectsText?=true}} |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{{input-text class="escape-clears-by-default" value="Escape Clears This Text"}} | ||
{{input-text class="escape-clears-enabled" value="Escape Clears This Text" escapeKeyClears?=true}} | ||
{{input-text class="escape-clears-disabled" value="Escape Will Not Clear This Text" escapeKeyClears?=false}} |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{{input-text class="select-enabled" value="Select This Text" focusSelectsText?=true}} | ||
|
||
{{input-text class="select-disabled" value="Text Will Not Select On Focus" focusSelectsText?=false}} |
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
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
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