Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gpt
large_projects
gitlabhq1
Commits
1f9a9629
Commit
1f9a9629
authored
8 years ago
by
Luke "Jared" Bennett
Committed by
Phil Hughes
8 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Fix clicking disabled clipboard button toolip
parent
a3eabcc2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
6 deletions
+29
-6
app/assets/javascripts/blob/viewer/index.js
app/assets/javascripts/blob/viewer/index.js
+2
-2
spec/javascripts/blob/viewer/index_spec.js
spec/javascripts/blob/viewer/index_spec.js
+27
-4
No files found.
app/assets/javascripts/blob/viewer/index.js
View file @
1f9a9629
...
...
@@ -50,9 +50,9 @@ export default class BlobViewer {
if
(
this
.
copySourceBtn
)
{
this
.
copySourceBtn
.
addEventListener
(
'
click
'
,
()
=>
{
if
(
this
.
copySourceBtn
.
classList
.
contains
(
'
disabled
'
))
return
;
if
(
this
.
copySourceBtn
.
classList
.
contains
(
'
disabled
'
))
return
this
.
copySourceBtn
.
blur
()
;
this
.
switchToViewer
(
'
simple
'
);
return
this
.
switchToViewer
(
'
simple
'
);
});
}
}
...
...
This diff is collapsed.
Click to expand it.
spec/javascripts/blob/viewer/index_spec.js
View file @
1f9a9629
...
...
@@ -83,25 +83,48 @@ describe('Blob viewer', () => {
});
describe
(
'
copy blob button
'
,
()
=>
{
let
copyButton
;
beforeEach
(()
=>
{
copyButton
=
document
.
querySelector
(
'
.js-copy-blob-source-btn
'
);
});
it
(
'
disabled on load
'
,
()
=>
{
expect
(
document
.
querySelector
(
'
.js-copy-blob-source-btn
'
)
.
classList
.
contains
(
'
disabled
'
),
copyButton
.
classList
.
contains
(
'
disabled
'
),
).
toBeTruthy
();
});
it
(
'
has tooltip when disabled
'
,
()
=>
{
expect
(
document
.
querySelector
(
'
.js-copy-blob-source-btn
'
)
.
getAttribute
(
'
data-original-title
'
),
copyButton
.
getAttribute
(
'
data-original-title
'
),
).
toBe
(
'
Switch to the source to copy it to the clipboard
'
);
});
it
(
'
is blurred when clicked and disabled
'
,
()
=>
{
spyOn
(
copyButton
,
'
blur
'
);
copyButton
.
click
();
expect
(
copyButton
.
blur
).
toHaveBeenCalled
();
});
it
(
'
is not blurred when clicked and not disabled
'
,
()
=>
{
spyOn
(
copyButton
,
'
blur
'
);
copyButton
.
classList
.
remove
(
'
disabled
'
);
copyButton
.
click
();
expect
(
copyButton
.
blur
).
not
.
toHaveBeenCalled
();
});
it
(
'
enables after switching to simple view
'
,
(
done
)
=>
{
document
.
querySelector
(
'
.js-blob-viewer-switch-btn[data-viewer="simple"]
'
).
click
();
setTimeout
(()
=>
{
expect
(
$
.
ajax
).
toHaveBeenCalled
();
expect
(
document
.
querySelector
(
'
.js-copy-blob-source-btn
'
)
.
classList
.
contains
(
'
disabled
'
),
copyButton
.
classList
.
contains
(
'
disabled
'
),
).
toBeFalsy
();
done
();
...
...
@@ -115,7 +138,7 @@ describe('Blob viewer', () => {
expect
(
$
.
ajax
).
toHaveBeenCalled
();
expect
(
document
.
querySelector
(
'
.js-copy-blob-source-btn
'
)
.
getAttribute
(
'
data-original-title
'
),
copyButton
.
getAttribute
(
'
data-original-title
'
),
).
toBe
(
'
Copy source to clipboard
'
);
done
();
...
...
This diff is collapsed.
Click to expand it.
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