Skip to content

Commit

Permalink
add failing test for #642
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelcobain committed Aug 20, 2018
1 parent ff97899 commit 18d53a1
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion tests/acceptance/editor-input-handlers-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Helpers from '../test-helpers';
import Range from 'mobiledoc-kit/utils/cursor/range';
import { NO_BREAK_SPACE } from 'mobiledoc-kit/renderers/editor-dom';
import { TAB } from 'mobiledoc-kit/utils/characters';
import { TAB, ENTER } from 'mobiledoc-kit/utils/characters';
import { MODIFIERS } from 'mobiledoc-kit/utils/key';

const { module, test } = Helpers;
Expand Down Expand Up @@ -301,6 +301,23 @@ test('input handler can be triggered by TAB', (assert) => {
assert.ok(didMatch);
});

test('input handler can be triggered by ENTER', (assert) => {
editor = Helpers.editor.buildFromText('abc|', {element: editorElement});

let didMatch;
editor.onTextInput({
name: 'test',
match: /abc\n/,
run() {
didMatch = true;
}
});

Helpers.dom.insertText(editor, ENTER);

assert.ok(didMatch);
});

// See https://github.com/bustle/mobiledoc-kit/issues/565
test('typing ctrl-TAB does not insert TAB text', (assert) => {
editor = Helpers.editor.buildFromText('abc|', {element: editorElement});
Expand Down

0 comments on commit 18d53a1

Please sign in to comment.