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
cd582d3c
Commit
cd582d3c
authored
Jan 31, 2017
by
Brian Hall
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary returns / unset variables from the CoffeeScript -> JS conversion.
parent
7bf6df84
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
25 deletions
+22
-25
spec/javascripts/shortcuts_issuable_spec.js
spec/javascripts/shortcuts_issuable_spec.js
+22
-25
No files found.
spec/javascripts/shortcuts_issuable_spec.js
View file @
cd582d3c
...
@@ -11,9 +11,9 @@
...
@@ -11,9 +11,9 @@
beforeEach
(
function
()
{
beforeEach
(
function
()
{
loadFixtures
(
fixtureName
);
loadFixtures
(
fixtureName
);
document
.
querySelector
(
'
.js-new-note-form
'
).
classList
.
add
(
'
js-main-target-form
'
);
document
.
querySelector
(
'
.js-new-note-form
'
).
classList
.
add
(
'
js-main-target-form
'
);
return
this
.
shortcut
=
new
ShortcutsIssuable
();
this
.
shortcut
=
new
ShortcutsIssuable
();
});
});
return
describe
(
'
#replyWithSelectedText
'
,
function
()
{
describe
(
'
#replyWithSelectedText
'
,
function
()
{
var
stubSelection
;
var
stubSelection
;
// Stub window.gl.utils.getSelectedFragment to return a node with the provided HTML.
// Stub window.gl.utils.getSelectedFragment to return a node with the provided HTML.
stubSelection
=
function
(
html
)
{
stubSelection
=
function
(
html
)
{
...
@@ -24,64 +24,61 @@
...
@@ -24,64 +24,61 @@
};
};
};
};
beforeEach
(
function
()
{
beforeEach
(
function
()
{
return
this
.
selector
=
'
form.js-main-target-form textarea#note_note
'
;
this
.
selector
=
'
form.js-main-target-form textarea#note_note
'
;
});
});
describe
(
'
with empty selection
'
,
function
()
{
describe
(
'
with empty selection
'
,
function
()
{
it
(
'
does not return an error
'
,
function
()
{
it
(
'
does not return an error
'
,
function
()
{
this
.
shortcut
.
replyWithSelectedText
();
this
.
shortcut
.
replyWithSelectedText
();
return
expect
(
$
(
this
.
selector
).
val
()).
toBe
(
''
);
expect
(
$
(
this
.
selector
).
val
()).
toBe
(
''
);
});
});
return
it
(
'
triggers `input`
'
,
function
()
{
it
(
'
triggers `input`
'
,
function
()
{
var
focused
;
var
focused
=
false
;
focused
=
false
;
$
(
this
.
selector
).
on
(
'
focus
'
,
function
()
{
$
(
this
.
selector
).
on
(
'
focus
'
,
function
()
{
return
focused
=
true
;
focused
=
true
;
});
});
this
.
shortcut
.
replyWithSelectedText
();
this
.
shortcut
.
replyWithSelectedText
();
return
expect
(
focused
).
toBe
(
true
);
expect
(
focused
).
toBe
(
true
);
});
});
});
});
describe
(
'
with any selection
'
,
function
()
{
describe
(
'
with any selection
'
,
function
()
{
beforeEach
(
function
()
{
beforeEach
(
function
()
{
return
stubSelection
(
'
<p>Selected text.</p>
'
);
stubSelection
(
'
<p>Selected text.</p>
'
);
});
});
it
(
'
leaves existing input intact
'
,
function
()
{
it
(
'
leaves existing input intact
'
,
function
()
{
$
(
this
.
selector
).
val
(
'
This text was already here.
'
);
$
(
this
.
selector
).
val
(
'
This text was already here.
'
);
expect
(
$
(
this
.
selector
).
val
()).
toBe
(
'
This text was already here.
'
);
expect
(
$
(
this
.
selector
).
val
()).
toBe
(
'
This text was already here.
'
);
this
.
shortcut
.
replyWithSelectedText
();
this
.
shortcut
.
replyWithSelectedText
();
return
expect
(
$
(
this
.
selector
).
val
()).
toBe
(
"
This text was already here.
\n\n
> Selected text.
\n\n
"
);
expect
(
$
(
this
.
selector
).
val
()).
toBe
(
"
This text was already here.
\n\n
> Selected text.
\n\n
"
);
});
});
it
(
'
triggers `input`
'
,
function
()
{
it
(
'
triggers `input`
'
,
function
()
{
var
triggered
;
var
triggered
=
false
;
triggered
=
false
;
$
(
this
.
selector
).
on
(
'
input
'
,
function
()
{
$
(
this
.
selector
).
on
(
'
input
'
,
function
()
{
return
triggered
=
true
;
triggered
=
true
;
});
});
this
.
shortcut
.
replyWithSelectedText
();
this
.
shortcut
.
replyWithSelectedText
();
return
expect
(
triggered
).
toBe
(
true
);
expect
(
triggered
).
toBe
(
true
);
});
});
return
it
(
'
triggers `focus`
'
,
function
()
{
it
(
'
triggers `focus`
'
,
function
()
{
var
focused
;
var
focused
=
false
;
focused
=
false
;
$
(
this
.
selector
).
on
(
'
focus
'
,
function
()
{
$
(
this
.
selector
).
on
(
'
focus
'
,
function
()
{
return
focused
=
true
;
focused
=
true
;
});
});
this
.
shortcut
.
replyWithSelectedText
();
this
.
shortcut
.
replyWithSelectedText
();
return
expect
(
focused
).
toBe
(
true
);
expect
(
focused
).
toBe
(
true
);
});
});
});
});
describe
(
'
with a one-line selection
'
,
function
()
{
describe
(
'
with a one-line selection
'
,
function
()
{
return
it
(
'
quotes the selection
'
,
function
()
{
it
(
'
quotes the selection
'
,
function
()
{
stubSelection
(
'
<p>This text has been selected.</p>
'
);
stubSelection
(
'
<p>This text has been selected.</p>
'
);
this
.
shortcut
.
replyWithSelectedText
();
this
.
shortcut
.
replyWithSelectedText
();
return
expect
(
$
(
this
.
selector
).
val
()).
toBe
(
"
> This text has been selected.
\n\n
"
);
expect
(
$
(
this
.
selector
).
val
()).
toBe
(
"
> This text has been selected.
\n\n
"
);
});
});
});
});
return
describe
(
'
with a multi-line selection
'
,
function
()
{
describe
(
'
with a multi-line selection
'
,
function
()
{
return
it
(
'
quotes the selected lines as a group
'
,
function
()
{
it
(
'
quotes the selected lines as a group
'
,
function
()
{
stubSelection
(
"
<p>Selected line one.</p>
\n\n
<p>Selected line two.</p>
\n\n
<p>Selected line three.</p>
"
);
stubSelection
(
"
<p>Selected line one.</p>
\n\n
<p>Selected line two.</p>
\n\n
<p>Selected line three.</p>
"
);
this
.
shortcut
.
replyWithSelectedText
();
this
.
shortcut
.
replyWithSelectedText
();
return
expect
(
$
(
this
.
selector
).
val
()).
toBe
(
"
> Selected line one.
\n
>
\n
> Selected line two.
\n
>
\n
> Selected line three.
\n\n
"
);
expect
(
$
(
this
.
selector
).
val
()).
toBe
(
"
> Selected line one.
\n
>
\n
> Selected line two.
\n
>
\n
> Selected line three.
\n\n
"
);
});
});
});
});
});
});
...
...
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