Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Keyboard Controls for Quick Editors Unit Tests #1273

Merged
merged 6 commits into from
Jul 19, 2012

Conversation

redmunds
Copy link
Contributor

Added a new function to SpecRunnerUtils for simulating keyboard events. Currently no way to specify modifier keys.

Added test to close an inline editor via Esc key. There are currently no unit tests for multiple inline editors, so there is no test for closing more than 1 via Esc key.

Added test for code hints.

Added test for closing context-menu via Esc Key. Opened issue #1270 for contextMenuClose event. There are no unit tests for closing main menus, so no tests were added for Esc key.

@ghost ghost assigned peterflynn Jul 18, 2012
var editor,
pos = {line: 3, ch: 1},
lineBefore,
lineAfter;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • lineAfter is unused
  • lineBefore is assigned but never read, so I think it can be removed also

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

// get text before insert operation
lineBefore = editor.document.getLine(pos.line);

CodeHintManager.handleKeyEvent(editor, e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have this simulateKeyEvent() utility now, would it be cleaner / more consistent to use it here too?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Randy mentioned that this one requires a modifier key (Ctrl), and it seems nontrivial to add modifier-key support to simulateKeyEvent()... so it's fine by me to leave this as-is.

@peterflynn
Copy link
Member

Done reviewing

@redmunds
Copy link
Contributor Author

done with updates

@peterflynn
Copy link
Member

Great! Merging now.

Good catch on adding that extra check to InlineEditorProviders-test, btw...

peterflynn added a commit that referenced this pull request Jul 19, 2012
Unit Tests for Esc key handling (Quick Editors, code hints, and context menu)

Also, add new utility to SpecRunnerUtils for simulating key events
@peterflynn peterflynn merged commit bb5de62 into master Jul 19, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants