Commit bb365419 authored by Clement Ho's avatar Clement Ho

Merge branch 'tz-upgrade-jasmine-and-raven' into 'master'

Upgrade jasmine + raven to newer versions

See merge request gitlab-org/gitlab-ce!16573
parents ea14c1e6 81bdb6ad
...@@ -118,14 +118,14 @@ export const showSubLevelItems = (el) => { ...@@ -118,14 +118,14 @@ export const showSubLevelItems = (el) => {
moveSubItemsToPosition(el, subItems); moveSubItemsToPosition(el, subItems);
}; };
export const mouseEnterTopItems = (el) => { export const mouseEnterTopItems = (el, timeout = getHideSubItemsInterval()) => {
clearTimeout(timeoutId); clearTimeout(timeoutId);
timeoutId = setTimeout(() => { timeoutId = setTimeout(() => {
if (currentOpenMenu) hideMenu(currentOpenMenu); if (currentOpenMenu) hideMenu(currentOpenMenu);
showSubLevelItems(el); showSubLevelItems(el);
}, getHideSubItemsInterval()); }, timeout);
}; };
export const mouseLeaveTopItem = (el) => { export const mouseLeaveTopItem = (el) => {
......
...@@ -167,30 +167,26 @@ describe('Fly out sidebar navigation', () => { ...@@ -167,30 +167,26 @@ describe('Fly out sidebar navigation', () => {
describe('mouseEnterTopItems', () => { describe('mouseEnterTopItems', () => {
beforeEach(() => { beforeEach(() => {
jasmine.clock().install();
el.innerHTML = '<div class="sidebar-sub-level-items" style="position: absolute; top: 0; left: 100px; height: 200px;"></div>'; el.innerHTML = '<div class="sidebar-sub-level-items" style="position: absolute; top: 0; left: 100px; height: 200px;"></div>';
}); });
afterEach(() => { it('shows sub-items after 0ms if no menu is open', (done) => {
jasmine.clock().uninstall();
});
it('shows sub-items after 0ms if no menu is open', () => {
mouseEnterTopItems(el); mouseEnterTopItems(el);
expect( expect(
getHideSubItemsInterval(), getHideSubItemsInterval(),
).toBe(0); ).toBe(0);
jasmine.clock().tick(0); setTimeout(() => {
expect(
el.querySelector('.sidebar-sub-level-items').style.display,
).toBe('block');
expect( done();
el.querySelector('.sidebar-sub-level-items').style.display, });
).toBe('block');
}); });
it('shows sub-items after 300ms if a menu is currently open', () => { it('shows sub-items after 300ms if a menu is currently open', (done) => {
documentMouseMove({ documentMouseMove({
clientX: el.getBoundingClientRect().left, clientX: el.getBoundingClientRect().left,
clientY: el.getBoundingClientRect().top, clientY: el.getBoundingClientRect().top,
...@@ -203,17 +199,19 @@ describe('Fly out sidebar navigation', () => { ...@@ -203,17 +199,19 @@ describe('Fly out sidebar navigation', () => {
clientY: el.getBoundingClientRect().top + 10, clientY: el.getBoundingClientRect().top + 10,
}); });
mouseEnterTopItems(el); mouseEnterTopItems(el, 0);
expect( expect(
getHideSubItemsInterval(), getHideSubItemsInterval(),
).toBe(300); ).toBe(300);
jasmine.clock().tick(300); setTimeout(() => {
expect(
el.querySelector('.sidebar-sub-level-items').style.display,
).toBe('block');
expect( done();
el.querySelector('.sidebar-sub-level-items').style.display, });
).toBe('block');
}); });
}); });
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import './class_spec_helper'; import './class_spec_helper';
describe('ClassSpecHelper', () => { describe('ClassSpecHelper', () => {
describe('itShouldBeAStaticMethod', function () { describe('itShouldBeAStaticMethod', () => {
beforeEach(() => { beforeEach(() => {
class TestClass { class TestClass {
instanceMethod() { this.prop = 'val'; } instanceMethod() { this.prop = 'val'; }
...@@ -14,23 +14,5 @@ describe('ClassSpecHelper', () => { ...@@ -14,23 +14,5 @@ describe('ClassSpecHelper', () => {
}); });
ClassSpecHelper.itShouldBeAStaticMethod(ClassSpecHelper, 'itShouldBeAStaticMethod'); ClassSpecHelper.itShouldBeAStaticMethod(ClassSpecHelper, 'itShouldBeAStaticMethod');
it('should have a defined spec', () => {
expect(ClassSpecHelper.itShouldBeAStaticMethod(this.TestClass, 'staticMethod').description).toBe('should be a static method');
});
it('should pass for a static method', () => {
const spec = ClassSpecHelper.itShouldBeAStaticMethod(this.TestClass, 'staticMethod');
expect(spec.status()).toBe('passed');
});
it('should fail for an instance method', (done) => {
const spec = ClassSpecHelper.itShouldBeAStaticMethod(this.TestClass, 'instanceMethod');
spec.resultCallback = (result) => {
expect(result.status).toBe('failed');
done();
};
spec.execute();
});
}); });
}); });
...@@ -25,7 +25,7 @@ describe('Modal', () => { ...@@ -25,7 +25,7 @@ describe('Modal', () => {
}); });
describe('with id', () => { describe('with id', () => {
it('does not render a primary button', () => { describe('does not render a primary button', () => {
beforeEach(() => { beforeEach(() => {
vm = mountComponent(modalComponent, { vm = mountComponent(modalComponent, {
id: 'my-modal', id: 'my-modal',
......
...@@ -21,22 +21,21 @@ describe('collapsedGroupedDatePicker', () => { ...@@ -21,22 +21,21 @@ describe('collapsedGroupedDatePicker', () => {
}); });
}); });
it('toggleCollapse events', () => { describe('toggleCollapse events', () => {
const toggleCollapse = jasmine.createSpy();
beforeEach((done) => { beforeEach((done) => {
spyOn(vm, 'toggleSidebar');
vm.minDate = new Date('07/17/2016'); vm.minDate = new Date('07/17/2016');
Vue.nextTick(done); Vue.nextTick(done);
}); });
it('should emit when sidebar is toggled', () => { it('should emit when sidebar is toggled', () => {
vm.$el.querySelector('.gutter-toggle').click(); vm.$el.querySelector('.gutter-toggle').click();
expect(toggleCollapse).toHaveBeenCalled(); expect(vm.toggleSidebar).toHaveBeenCalled();
}); });
it('should emit when collapsed-calendar-icon is clicked', () => { it('should emit when collapsed-calendar-icon is clicked', () => {
vm.$el.querySelector('.sidebar-collapsed-icon').click(); vm.$el.querySelector('.sidebar-collapsed-icon').click();
expect(toggleCollapse).toHaveBeenCalled(); expect(vm.toggleSidebar).toHaveBeenCalled();
}); });
}); });
......
...@@ -4185,9 +4185,9 @@ isurl@^1.0.0-alpha5: ...@@ -4185,9 +4185,9 @@ isurl@^1.0.0-alpha5:
has-to-string-tag-x "^1.2.0" has-to-string-tag-x "^1.2.0"
is-object "^1.0.1" is-object "^1.0.1"
jasmine-core@^2.6.3: jasmine-core@^2.9.0:
version "2.6.3" version "2.9.0"
resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.6.3.tgz#45072950e4a42b1e322fe55c001100a465d77815" resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.9.0.tgz#bfbb56defcd30789adec5a3fbba8504233289c72"
jasmine-jquery@^2.1.1: jasmine-jquery@^2.1.1:
version "2.1.1" version "2.1.1"
...@@ -4269,7 +4269,7 @@ json-stable-stringify@~0.0.0: ...@@ -4269,7 +4269,7 @@ json-stable-stringify@~0.0.0:
dependencies: dependencies:
jsonify "~0.0.0" jsonify "~0.0.0"
json-stringify-safe@5.0.x, json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: json-stringify-safe@5.0.x, json-stringify-safe@~5.0.1:
version "5.0.1" version "5.0.1"
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
...@@ -6067,11 +6067,9 @@ raphael@^2.2.7: ...@@ -6067,11 +6067,9 @@ raphael@^2.2.7:
dependencies: dependencies:
eve-raphael "0.5.0" eve-raphael "0.5.0"
raven-js@^3.14.0: raven-js@^3.22.1:
version "3.14.0" version "3.22.1"
resolved "https://registry.yarnpkg.com/raven-js/-/raven-js-3.14.0.tgz#94dda81d975fdc4a42f193db437cf70021d654e0" resolved "https://registry.yarnpkg.com/raven-js/-/raven-js-3.22.1.tgz#1117f00dfefaa427ef6e1a7d50bbb1fb998a24da"
dependencies:
json-stringify-safe "^5.0.1"
raw-body@2: raw-body@2:
version "2.3.2" version "2.3.2"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment