From 6f1d8201d01cff28d7d236899d9e3d9835e23288 Mon Sep 17 00:00:00 2001
From: winniehell <git@winniehell.de>
Date: Mon, 13 Feb 2017 01:29:07 +0100
Subject: [PATCH] Replace static fixture for project_title_spec.js (!9175)

---
 .../dynamic-project-title-fixture.yml         |  4 ++++
 .../fixtures/project_title.html.haml          | 20 -------------------
 spec/javascripts/project_title_spec.js        | 19 ++++++++----------
 3 files changed, 12 insertions(+), 31 deletions(-)
 create mode 100644 changelogs/unreleased/dynamic-project-title-fixture.yml
 delete mode 100644 spec/javascripts/fixtures/project_title.html.haml

diff --git a/changelogs/unreleased/dynamic-project-title-fixture.yml b/changelogs/unreleased/dynamic-project-title-fixture.yml
new file mode 100644
index 00000000000..2404cbb891c
--- /dev/null
+++ b/changelogs/unreleased/dynamic-project-title-fixture.yml
@@ -0,0 +1,4 @@
+---
+title: Replace static fixture for project_title_spec.js
+merge_request: 9175
+author: winniehell
diff --git a/spec/javascripts/fixtures/project_title.html.haml b/spec/javascripts/fixtures/project_title.html.haml
deleted file mode 100644
index 9d1f7877116..00000000000
--- a/spec/javascripts/fixtures/project_title.html.haml
+++ /dev/null
@@ -1,20 +0,0 @@
-.header-content
-  %h1.title
-    %a
-      GitLab Org
-    %a.project-item-select-holder{href: "/gitlab-org/gitlab-test"}
-      GitLab Test
-    %i.fa.chevron-down.dropdown-toggle-caret.js-projects-dropdown-toggle{ "data-toggle" => "dropdown", "data-target" => ".header-content", "data-order-by" => "last_activity_at" }
-  .js-dropdown-menu-projects
-    .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
diff --git a/spec/javascripts/project_title_spec.js b/spec/javascripts/project_title_spec.js
index bfe3d2df79d..6e72c3f8310 100644
--- a/spec/javascripts/project_title_spec.js
+++ b/spec/javascripts/project_title_spec.js
@@ -10,11 +10,11 @@ require('~/project');
 
 (function() {
   describe('Project Title', function() {
-    preloadFixtures('static/project_title.html.raw');
+    preloadFixtures('issues/open-issue.html.raw');
     loadJSONFixtures('projects.json');
 
     beforeEach(function() {
-      loadFixtures('static/project_title.html.raw');
+      loadFixtures('issues/open-issue.html.raw');
 
       window.gon = {};
       window.gon.api_version = 'v3';
@@ -38,15 +38,12 @@ require('~/project');
           return spyOn(jQuery, 'ajax').and.callFake(fakeAjaxResponse.bind(_this));
         };
       })(this));
-      it('to show on toggle click', (function(_this) {
-        return function() {
-          $('.js-projects-dropdown-toggle').click();
-          return expect($('.header-content').hasClass('open')).toBe(true);
-        };
-      })(this));
-      return it('hide dropdown', function() {
-        $(".dropdown-menu-close-icon").click();
-        return expect($('.header-content').hasClass('open')).toBe(false);
+      it('toggles dropdown', function() {
+        var menu = $('.js-dropdown-menu-projects');
+        $('.js-projects-dropdown-toggle').click();
+        expect(menu).toHaveClass('open');
+        menu.find('.dropdown-menu-close-icon').click();
+        expect(menu).not.toHaveClass('open');
       });
     });
 
-- 
GitLab