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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
a980a4f6
Commit
a980a4f6
authored
Jun 02, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added tests for collapsing
parent
b6e39b02
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
141 additions
and
1 deletion
+141
-1
spec/javascripts/boards/components/board_spec.js
spec/javascripts/boards/components/board_spec.js
+112
-0
spec/javascripts/fixtures/boards.rb
spec/javascripts/fixtures/boards.rb
+28
-0
spec/support/javascript_fixtures_helpers.rb
spec/support/javascript_fixtures_helpers.rb
+1
-1
No files found.
spec/javascripts/boards/components/board_spec.js
0 → 100644
View file @
a980a4f6
import
Vue
from
'
vue
'
;
import
'
~/boards/services/board_service
'
;
import
'
~/boards/components/board
'
;
import
'
~/boards/models/list
'
;
describe
(
'
Board component
'
,
()
=>
{
let
vm
;
let
el
;
beforeEach
((
done
)
=>
{
loadFixtures
(
'
boards/show.html.raw
'
);
el
=
document
.
createElement
(
'
div
'
);
document
.
body
.
appendChild
(
el
);
// eslint-disable-next-line no-undef
gl
.
boardService
=
new
BoardService
(
'
/
'
,
'
/
'
,
1
);
vm
=
new
gl
.
issueBoards
.
Board
({
propsData
:
{
boardId
:
'
1
'
,
disabled
:
false
,
issueLinkBase
:
'
/
'
,
rootPath
:
'
/
'
,
// eslint-disable-next-line no-undef
list
:
new
List
({
id
:
1
,
position
:
0
,
title
:
'
test
'
,
list_type
:
'
backlog
'
,
}),
},
}).
$mount
(
el
);
Vue
.
nextTick
(
done
);
});
afterEach
(()
=>
{
vm
.
$destroy
();
// remove the component from the DOM
document
.
querySelector
(
'
.board
'
).
remove
();
localStorage
.
removeItem
(
`boards.
${
vm
.
boardId
}
.
${
vm
.
list
.
type
}
.expanded`
);
});
it
(
'
board is expandable when list type is backlog
'
,
()
=>
{
expect
(
vm
.
$el
.
classList
.
contains
(
'
is-expandable
'
),
).
toBe
(
true
);
});
it
(
'
board is expandable when list type is closed
'
,
(
done
)
=>
{
vm
.
list
.
type
=
'
closed
'
;
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
classList
.
contains
(
'
is-expandable
'
),
).
toBe
(
true
);
done
();
});
});
it
(
'
board is not expandable when list type is label
'
,
(
done
)
=>
{
vm
.
list
.
type
=
'
label
'
;
vm
.
list
.
isExpandable
=
false
;
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
classList
.
contains
(
'
is-expandable
'
),
).
toBe
(
false
);
done
();
});
});
it
(
'
collapses when clicking header
'
,
(
done
)
=>
{
vm
.
$el
.
querySelector
(
'
.board-header
'
).
click
();
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
classList
.
contains
(
'
is-collapsed
'
),
).
toBe
(
true
);
done
();
});
});
it
(
'
created sets isExpanded to true from localStorage
'
,
(
done
)
=>
{
vm
.
$el
.
querySelector
(
'
.board-header
'
).
click
();
return
Vue
.
nextTick
()
.
then
(()
=>
{
expect
(
vm
.
$el
.
classList
.
contains
(
'
is-collapsed
'
),
).
toBe
(
true
);
// call created manually
vm
.
$options
.
created
[
0
].
call
(
vm
);
return
Vue
.
nextTick
();
})
.
then
(()
=>
{
expect
(
vm
.
$el
.
classList
.
contains
(
'
is-collapsed
'
),
).
toBe
(
true
);
done
();
});
});
});
spec/javascripts/fixtures/boards.rb
0 → 100644
View file @
a980a4f6
require
'spec_helper'
describe
Projects
::
BoardsController
,
'(JavaScript fixtures)'
,
type: :controller
do
include
JavaScriptFixturesHelpers
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:namespace
)
{
create
(
:namespace
,
name:
'frontend-fixtures'
)}
let
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
namespace
,
path:
'boards-project'
)
}
render_views
before
(
:all
)
do
clean_frontend_fixtures
(
'boards/'
)
end
before
(
:each
)
do
sign_in
(
admin
)
end
it
'boards/show.html.raw'
do
|
example
|
get
(
:index
,
namespace_id:
project
.
namespace
,
project_id:
project
)
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
end
end
spec/support/javascript_fixtures_helpers.rb
View file @
a980a4f6
...
...
@@ -48,7 +48,7 @@ module JavaScriptFixturesHelpers
link_tags
=
doc
.
css
(
'link'
)
link_tags
.
remove
scripts
=
doc
.
css
(
"script:not([type='text/template'])"
)
scripts
=
doc
.
css
(
"script:not([type='text/template'])
:not([type='text/x-template'])
"
)
scripts
.
remove
fixture
=
doc
.
to_html
...
...
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