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
89d1a1c0
Commit
89d1a1c0
authored
Mar 27, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added specs for collapsed sidebar
parent
04990da1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
133 additions
and
10 deletions
+133
-10
app/assets/javascripts/right_sidebar.js
app/assets/javascripts/right_sidebar.js
+9
-9
spec/javascripts/collapsed_sidebar_todo_spec.js
spec/javascripts/collapsed_sidebar_todo_spec.js
+123
-0
spec/javascripts/right_sidebar_spec.js
spec/javascripts/right_sidebar_spec.js
+1
-1
No files found.
app/assets/javascripts/right_sidebar.js
View file @
89d1a1c0
...
@@ -103,15 +103,15 @@ import Cookies from 'js-cookie';
...
@@ -103,15 +103,15 @@ import Cookies from 'js-cookie';
.
attr
(
'
data-delete-path
'
,
deletePath
)
.
attr
(
'
data-delete-path
'
,
deletePath
)
.
attr
(
'
title
'
,
$el
.
data
(
`
${
attrPrefix
}
-text`
));
.
attr
(
'
title
'
,
$el
.
data
(
`
${
attrPrefix
}
-text`
));
if
(
$el
.
hasClass
(
'
has-tooltip
'
))
{
if
(
$el
.
hasClass
(
'
has-tooltip
'
))
{
$el
.
tooltip
(
'
fixTitle
'
);
$el
.
tooltip
(
'
fixTitle
'
);
}
}
if
(
$el
.
data
(
`
${
attrPrefix
}
-icon`
))
{
if
(
$el
.
data
(
`
${
attrPrefix
}
-icon`
))
{
$elText
.
html
(
$el
.
data
(
`
${
attrPrefix
}
-icon`
));
$elText
.
html
(
$el
.
data
(
`
${
attrPrefix
}
-icon`
));
}
else
{
}
else
{
$elText
.
text
(
$el
.
data
(
`
${
attrPrefix
}
-text`
));
$elText
.
text
(
$el
.
data
(
`
${
attrPrefix
}
-text`
));
}
}
});
});
};
};
...
...
spec/javascripts/collapsed_sidebar_todo_spec.js
0 → 100644
View file @
89d1a1c0
/* global Sidebar */
/* eslint-disable no-new */
import
_
from
'
underscore
'
;
import
'
~/right_sidebar
'
;
describe
(
'
Issuable right sidebar collapsed todo toggle
'
,
()
=>
{
const
fixtureName
=
'
issues/open-issue.html.raw
'
;
const
jsonFixtureName
=
'
todos/todos.json
'
;
preloadFixtures
(
fixtureName
);
preloadFixtures
(
jsonFixtureName
);
beforeEach
(()
=>
{
const
todoData
=
getJSONFixture
(
jsonFixtureName
);
new
Sidebar
();
loadFixtures
(
fixtureName
);
document
.
querySelector
(
'
.js-right-sidebar
'
)
.
classList
.
toggle
(
'
right-sidebar-expanded
'
);
document
.
querySelector
(
'
.js-right-sidebar
'
)
.
classList
.
toggle
(
'
right-sidebar-collapsed
'
);
spyOn
(
jQuery
,
'
ajax
'
).
and
.
callFake
((
res
)
=>
{
const
d
=
$
.
Deferred
();
const
response
=
_
.
clone
(
todoData
);
if
(
res
.
type
===
'
DELETE
'
)
{
delete
response
.
delete_path
;
}
d
.
resolve
(
response
);
return
d
.
promise
();
});
});
it
(
'
shows add todo button
'
,
()
=>
{
expect
(
document
.
querySelector
(
'
.js-issuable-todo.sidebar-collapsed-icon
'
),
).
not
.
toBeNull
();
expect
(
document
.
querySelector
(
'
.js-issuable-todo.sidebar-collapsed-icon .fa-plus-square
'
),
).
not
.
toBeNull
();
expect
(
document
.
querySelector
(
'
.js-issuable-todo.sidebar-collapsed-icon .todo-undone
'
),
).
toBeNull
();
});
it
(
'
sets default tooltip title
'
,
()
=>
{
expect
(
document
.
querySelector
(
'
.js-issuable-todo.sidebar-collapsed-icon
'
).
getAttribute
(
'
title
'
),
).
toBe
(
'
Add todo
'
);
});
it
(
'
toggle todo state
'
,
()
=>
{
document
.
querySelector
(
'
.js-issuable-todo.sidebar-collapsed-icon
'
).
click
();
expect
(
document
.
querySelector
(
'
.js-issuable-todo.sidebar-collapsed-icon .todo-undone
'
),
).
not
.
toBeNull
();
expect
(
document
.
querySelector
(
'
.js-issuable-todo.sidebar-collapsed-icon .fa-check-square
'
),
).
not
.
toBeNull
();
});
it
(
'
toggle todo state of expanded todo toggle
'
,
()
=>
{
document
.
querySelector
(
'
.js-issuable-todo.sidebar-collapsed-icon
'
).
click
();
expect
(
document
.
querySelector
(
'
.issuable-sidebar-header .js-issuable-todo
'
).
textContent
.
trim
(),
).
toBe
(
'
Mark done
'
);
});
it
(
'
toggles todo button tooltip
'
,
()
=>
{
document
.
querySelector
(
'
.js-issuable-todo.sidebar-collapsed-icon
'
).
click
();
expect
(
document
.
querySelector
(
'
.js-issuable-todo.sidebar-collapsed-icon
'
).
getAttribute
(
'
data-original-title
'
),
).
toBe
(
'
Mark done
'
);
});
it
(
'
marks todo as done
'
,
()
=>
{
document
.
querySelector
(
'
.js-issuable-todo.sidebar-collapsed-icon
'
).
click
();
expect
(
document
.
querySelector
(
'
.js-issuable-todo.sidebar-collapsed-icon .todo-undone
'
),
).
not
.
toBeNull
();
document
.
querySelector
(
'
.js-issuable-todo.sidebar-collapsed-icon
'
).
click
();
expect
(
document
.
querySelector
(
'
.js-issuable-todo.sidebar-collapsed-icon .todo-undone
'
),
).
toBeNull
();
expect
(
document
.
querySelector
(
'
.issuable-sidebar-header .js-issuable-todo
'
).
textContent
.
trim
(),
).
toBe
(
'
Add todo
'
);
});
it
(
'
updates aria-label to mark done
'
,
()
=>
{
document
.
querySelector
(
'
.js-issuable-todo.sidebar-collapsed-icon
'
).
click
();
expect
(
document
.
querySelector
(
'
.js-issuable-todo.sidebar-collapsed-icon
'
).
getAttribute
(
'
aria-label
'
),
).
toBe
(
'
Mark done
'
);
});
it
(
'
updates aria-label to add todo
'
,
()
=>
{
document
.
querySelector
(
'
.js-issuable-todo.sidebar-collapsed-icon
'
).
click
();
expect
(
document
.
querySelector
(
'
.js-issuable-todo.sidebar-collapsed-icon
'
).
getAttribute
(
'
aria-label
'
),
).
toBe
(
'
Mark done
'
);
document
.
querySelector
(
'
.js-issuable-todo.sidebar-collapsed-icon
'
).
click
();
expect
(
document
.
querySelector
(
'
.js-issuable-todo.sidebar-collapsed-icon
'
).
getAttribute
(
'
aria-label
'
),
).
toBe
(
'
Add todo
'
);
});
});
spec/javascripts/right_sidebar_spec.js
View file @
89d1a1c0
...
@@ -74,7 +74,7 @@ import '~/right_sidebar';
...
@@ -74,7 +74,7 @@ import '~/right_sidebar';
var
todoToggleSpy
=
spyOnEvent
(
document
,
'
todo:toggle
'
);
var
todoToggleSpy
=
spyOnEvent
(
document
,
'
todo:toggle
'
);
$
(
'
.js-issuable-todo
'
).
click
();
$
(
'
.
issuable-sidebar-header .
js-issuable-todo
'
).
click
();
expect
(
todoToggleSpy
.
calls
.
count
()).
toEqual
(
1
);
expect
(
todoToggleSpy
.
calls
.
count
()).
toEqual
(
1
);
});
});
...
...
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