Fix some karma specs

This commit is contained in:
Clement Ho 2018-04-24 15:43:55 -05:00
parent 7fe9102a74
commit fe60886aa2
4 changed files with 13 additions and 13 deletions

View file

@ -48,7 +48,7 @@ document.addEventListener('beforeunload', () => {
// Close any open tooltips
$('.has-tooltip, [data-toggle="tooltip"]').tooltip('dispose');
// Close any open popover
$('[data-toggle="popover"]').popover('destroy');
$('[data-toggle="popover"]').popover('dispose');
});
window.addEventListener('hashchange', handleLocationHash);

View file

@ -17,6 +17,6 @@ export default {
},
unbind(el) {
$(el).popover('destroy');
$(el).popover('dispose');
},
};

View file

@ -248,13 +248,13 @@ describe('Issue card component', () => {
it('renders list label', () => {
expect(
component.$el.querySelectorAll('.label').length,
component.$el.querySelectorAll('.badge').length,
).toBe(2);
});
it('renders label', () => {
const nodes = [];
component.$el.querySelectorAll('.label').forEach((label) => {
component.$el.querySelectorAll('.badge').forEach((label) => {
nodes.push(label.title);
});
@ -265,13 +265,13 @@ describe('Issue card component', () => {
it('sets label description as title', () => {
expect(
component.$el.querySelector('.label').getAttribute('title'),
component.$el.querySelector('.badge').getAttribute('title'),
).toContain(label1.description);
});
it('sets background color of button', () => {
const nodes = [];
component.$el.querySelectorAll('.label').forEach((label) => {
component.$el.querySelectorAll('.badge').forEach((label) => {
nodes.push(label.style.backgroundColor);
});
@ -288,7 +288,7 @@ describe('Issue card component', () => {
Vue.nextTick()
.then(() => {
expect(
component.$el.querySelectorAll('.label').length,
component.$el.querySelectorAll('.badge').length,
).toBe(2);
expect(
component.$el.textContent,

View file

@ -71,9 +71,9 @@ describe('glDropdown', function describeDropdown() {
it('should open on click', () => {
initDropDown.call(this, false);
expect(this.dropdownContainerElement).not.toHaveClass('open');
expect(this.dropdownContainerElement).not.toHaveClass('show');
this.dropdownButtonElement.click();
expect(this.dropdownContainerElement).toHaveClass('open');
expect(this.dropdownContainerElement).toHaveClass('show');
});
it('escapes HTML as text', () => {
@ -135,12 +135,12 @@ describe('glDropdown', function describeDropdown() {
});
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;
navigateWithKeys('down', randomIndex, () => {
spyOn(urlUtils, 'visitUrl').and.stub();
navigateWithKeys('enter', null, () => {
expect(this.dropdownContainerElement).not.toHaveClass('open');
expect(this.dropdownContainerElement).not.toHaveClass('show');
const link = $(`${ITEM_SELECTOR}:eq(${randomIndex}) a`, this.$dropdownMenuElement);
expect(link).toHaveClass('is-active');
const linkedLocation = link.attr('href');
@ -150,13 +150,13 @@ describe('glDropdown', function describeDropdown() {
});
it('should close on ESC keypress', () => {
expect(this.dropdownContainerElement).toHaveClass('open');
expect(this.dropdownContainerElement).toHaveClass('show');
this.dropdownContainerElement.trigger({
type: 'keyup',
which: ARROW_KEYS.ESC,
keyCode: ARROW_KEYS.ESC
});
expect(this.dropdownContainerElement).not.toHaveClass('open');
expect(this.dropdownContainerElement).not.toHaveClass('show');
});
});