Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f5f97359
Commit
f5f97359
authored
Apr 21, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved the spec
Now correctly tests against different forms
parent
b8a96fda
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
9 deletions
+25
-9
spec/javascripts/shortcuts_spec.js
spec/javascripts/shortcuts_spec.js
+25
-9
No files found.
spec/javascripts/shortcuts_spec.js
View file @
f5f97359
/* global Shortcuts */
/* global Shortcuts */
describe
(
'
Shortcuts
'
,
()
=>
{
describe
(
'
Shortcuts
'
,
()
=>
{
const
fixtureName
=
'
issues/open-issue.html.raw
'
;
const
fixtureName
=
'
issues/issue_with_comment.html.raw
'
;
const
createEvent
=
(
type
,
target
)
=>
$
.
Event
(
type
,
{
target
,
});
preloadFixtures
(
fixtureName
);
preloadFixtures
(
fixtureName
);
describe
(
'
toggleMarkdownPreview
'
,
()
=>
{
describe
(
'
toggleMarkdownPreview
'
,
()
=>
{
let
sc
;
let
sc
;
let
event
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
loadFixtures
(
fixtureName
);
loadFixtures
(
fixtureName
);
spyOnEvent
(
'
.js-md-preview-button
'
,
'
focus
'
);
spyOnEvent
(
'
.js-new-note-form .js-md-preview-button
'
,
'
focus
'
);
spyOnEvent
(
'
.edit-note .js-md-preview-button
'
,
'
focus
'
);
event
=
$
.
Event
(
''
,
{
target
:
document
.
querySelector
(
'
.js-note-text
'
),
});
sc
=
new
Shortcuts
();
sc
=
new
Shortcuts
();
});
});
it
(
'
focuses preview button in form
'
,
()
=>
{
it
(
'
focuses preview button in form
'
,
()
=>
{
sc
.
toggleMarkdownPreview
(
event
);
sc
.
toggleMarkdownPreview
(
createEvent
(
'
KeyboardEvent
'
,
document
.
querySelector
(
'
.js-new-note-form .js-note-text
'
),
));
expect
(
'
focus
'
).
toHaveBeenTriggeredOn
(
'
.js-new-note-form .js-md-preview-button
'
);
});
expect
(
'
focus
'
).
toHaveBeenTriggeredOn
(
'
.js-md-preview-button
'
);
it
(
'
focues preview button inside edit comment form
'
,
(
done
)
=>
{
document
.
querySelector
(
'
.js-note-edit
'
).
click
();
setTimeout
(()
=>
{
sc
.
toggleMarkdownPreview
(
createEvent
(
'
KeyboardEvent
'
,
document
.
querySelector
(
'
.edit-note .js-note-text
'
),
));
expect
(
'
focus
'
).
not
.
toHaveBeenTriggeredOn
(
'
.js-new-note-form .js-md-preview-button
'
);
expect
(
'
focus
'
).
toHaveBeenTriggeredOn
(
'
.edit-note .js-md-preview-button
'
);
done
();
});
});
});
});
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment