Tests update

This commit is contained in:
Phil Hughes 2016-03-29 13:21:22 +01:00 committed by Jacob Schatz
parent f870857ddd
commit 14b124faca
2 changed files with 24 additions and 22 deletions

View file

@ -1,7 +1,19 @@
.header-content
%h1.title
%a
GitLab Org
%a.project-item-select-holder{href: "/gitlab-org/gitlab-test"}
GitLab Test
%input#project_path.project-item-select.js-projects-dropdown.ajax-project-select{type: "hidden", name: "project_path", "data-include-groups" => "false"}
%i.fa.chevron-down.dropdown-toggle-caret.js-projects-dropdown-toggle
%i.fa.chevron-down.dropdown-toggle-caret.js-projects-dropdown-toggle{ "data-toggle" => "dropdown", "data-target" => ".header-content" }
.dropdown-menu.dropdown-select.dropdown-menu-projects
.dropdown-title
%span Go to a project
%button.dropdown-title-button.dropdown-menu-close{"aria-label" => "Close", type: "button"}
%i.fa.fa-times.dropdown-menu-close-icon
.dropdown-input
%input.dropdown-input-field{id: "", placeholder: "Search your projects", type: "search", value: ""}
%i.fa.fa-search.dropdown-input-search
%i.fa.fa-times.dropdown-input-clear.js-dropdown-input-clear{role: "button"}
.dropdown-content
.dropdown-loading
%i.fa.fa-spinner.fa-spin

View file

@ -1,4 +1,6 @@
#= require bootstrap
#= require select2
#= require gl_dropdown
#= require api
#= require project_select
#= require project
@ -14,9 +16,6 @@ describe 'Project Title', ->
fixture.load('project_title.html')
@project = new Project()
spyOn(@project, 'changeProject').and.callFake (url) ->
window.current_project_url = url
describe 'project list', ->
beforeEach =>
@projects_data = fixture.load('projects.json')[0]
@ -29,18 +28,9 @@ describe 'Project Title', ->
it 'to show on toggle click', =>
$('.js-projects-dropdown-toggle').click()
expect($('.title .select2-container').hasClass('select2-dropdown-open')).toBe(true)
expect($('.ajax-project-dropdown li').length).toBe(@projects_data.length)
expect($('.header-content').hasClass('open')).toBe(true)
it 'hide dropdown', ->
$("#select2-drop-mask").click()
$(".dropdown-menu-close-icon").click()
expect($('.title .select2-container').hasClass('select2-dropdown-open')).toBe(false)
it 'change project when clicking item', ->
$('.js-projects-dropdown-toggle').click()
$('.ajax-project-dropdown li:nth-child(2)').trigger('mouseup')
expect($('.title .select2-container').hasClass('select2-dropdown-open')).toBe(false)
expect(window.current_project_url).toBe('http://localhost:3000/h5bp/html5-boilerplate')
expect($('.header-content').hasClass('open')).toBe(false)