Commit fe60886a authored by Clement Ho's avatar Clement Ho

Fix some karma specs

parent 7fe9102a
...@@ -48,7 +48,7 @@ document.addEventListener('beforeunload', () => { ...@@ -48,7 +48,7 @@ document.addEventListener('beforeunload', () => {
// Close any open tooltips // Close any open tooltips
$('.has-tooltip, [data-toggle="tooltip"]').tooltip('dispose'); $('.has-tooltip, [data-toggle="tooltip"]').tooltip('dispose');
// Close any open popover // Close any open popover
$('[data-toggle="popover"]').popover('destroy'); $('[data-toggle="popover"]').popover('dispose');
}); });
window.addEventListener('hashchange', handleLocationHash); window.addEventListener('hashchange', handleLocationHash);
......
...@@ -17,6 +17,6 @@ export default { ...@@ -17,6 +17,6 @@ export default {
}, },
unbind(el) { unbind(el) {
$(el).popover('destroy'); $(el).popover('dispose');
}, },
}; };
...@@ -248,13 +248,13 @@ describe('Issue card component', () => { ...@@ -248,13 +248,13 @@ describe('Issue card component', () => {
it('renders list label', () => { it('renders list label', () => {
expect( expect(
component.$el.querySelectorAll('.label').length, component.$el.querySelectorAll('.badge').length,
).toBe(2); ).toBe(2);
}); });
it('renders label', () => { it('renders label', () => {
const nodes = []; const nodes = [];
component.$el.querySelectorAll('.label').forEach((label) => { component.$el.querySelectorAll('.badge').forEach((label) => {
nodes.push(label.title); nodes.push(label.title);
}); });
...@@ -265,13 +265,13 @@ describe('Issue card component', () => { ...@@ -265,13 +265,13 @@ describe('Issue card component', () => {
it('sets label description as title', () => { it('sets label description as title', () => {
expect( expect(
component.$el.querySelector('.label').getAttribute('title'), component.$el.querySelector('.badge').getAttribute('title'),
).toContain(label1.description); ).toContain(label1.description);
}); });
it('sets background color of button', () => { it('sets background color of button', () => {
const nodes = []; const nodes = [];
component.$el.querySelectorAll('.label').forEach((label) => { component.$el.querySelectorAll('.badge').forEach((label) => {
nodes.push(label.style.backgroundColor); nodes.push(label.style.backgroundColor);
}); });
...@@ -288,7 +288,7 @@ describe('Issue card component', () => { ...@@ -288,7 +288,7 @@ describe('Issue card component', () => {
Vue.nextTick() Vue.nextTick()
.then(() => { .then(() => {
expect( expect(
component.$el.querySelectorAll('.label').length, component.$el.querySelectorAll('.badge').length,
).toBe(2); ).toBe(2);
expect( expect(
component.$el.textContent, component.$el.textContent,
......
...@@ -71,9 +71,9 @@ describe('glDropdown', function describeDropdown() { ...@@ -71,9 +71,9 @@ describe('glDropdown', function describeDropdown() {
it('should open on click', () => { it('should open on click', () => {
initDropDown.call(this, false); initDropDown.call(this, false);
expect(this.dropdownContainerElement).not.toHaveClass('open'); expect(this.dropdownContainerElement).not.toHaveClass('show');
this.dropdownButtonElement.click(); this.dropdownButtonElement.click();
expect(this.dropdownContainerElement).toHaveClass('open'); expect(this.dropdownContainerElement).toHaveClass('show');
}); });
it('escapes HTML as text', () => { it('escapes HTML as text', () => {
...@@ -135,12 +135,12 @@ describe('glDropdown', function describeDropdown() { ...@@ -135,12 +135,12 @@ describe('glDropdown', function describeDropdown() {
}); });
it('should click the selected item on ENTER keypress', () => { it('should click the selected item on ENTER keypress', () => {
expect(this.dropdownContainerElement).toHaveClass('open'); expect(this.dropdownContainerElement).toHaveClass('show');
const randomIndex = Math.floor(Math.random() * (this.projectsData.length - 1)) + 0; const randomIndex = Math.floor(Math.random() * (this.projectsData.length - 1)) + 0;
navigateWithKeys('down', randomIndex, () => { navigateWithKeys('down', randomIndex, () => {
spyOn(urlUtils, 'visitUrl').and.stub(); spyOn(urlUtils, 'visitUrl').and.stub();
navigateWithKeys('enter', null, () => { navigateWithKeys('enter', null, () => {
expect(this.dropdownContainerElement).not.toHaveClass('open'); expect(this.dropdownContainerElement).not.toHaveClass('show');
const link = $(`${ITEM_SELECTOR}:eq(${randomIndex}) a`, this.$dropdownMenuElement); const link = $(`${ITEM_SELECTOR}:eq(${randomIndex}) a`, this.$dropdownMenuElement);
expect(link).toHaveClass('is-active'); expect(link).toHaveClass('is-active');
const linkedLocation = link.attr('href'); const linkedLocation = link.attr('href');
...@@ -150,13 +150,13 @@ describe('glDropdown', function describeDropdown() { ...@@ -150,13 +150,13 @@ describe('glDropdown', function describeDropdown() {
}); });
it('should close on ESC keypress', () => { it('should close on ESC keypress', () => {
expect(this.dropdownContainerElement).toHaveClass('open'); expect(this.dropdownContainerElement).toHaveClass('show');
this.dropdownContainerElement.trigger({ this.dropdownContainerElement.trigger({
type: 'keyup', type: 'keyup',
which: ARROW_KEYS.ESC, which: ARROW_KEYS.ESC,
keyCode: ARROW_KEYS.ESC keyCode: ARROW_KEYS.ESC
}); });
expect(this.dropdownContainerElement).not.toHaveClass('open'); expect(this.dropdownContainerElement).not.toHaveClass('show');
}); });
}); });
......
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