Commit 19336248 authored by Brandon Labuschagne's avatar Brandon Labuschagne

Fix failing tests

A number of the karma tests looked for the .fa-spinner class or the
icon element used for the font awesome spinner class.

These instances have been refactored to now look for the .spinner
class instead.
parent 076ebedc
...@@ -60,7 +60,7 @@ describe('BadgeList component', () => { ...@@ -60,7 +60,7 @@ describe('BadgeList component', () => {
Vue.nextTick() Vue.nextTick()
.then(() => { .then(() => {
const loadingIcon = vm.$el.querySelector('.fa-spinner'); const loadingIcon = vm.$el.querySelector('.spinner');
expect(loadingIcon).toBeVisible(); expect(loadingIcon).toBeVisible();
}) })
......
...@@ -15,7 +15,7 @@ describe('Badge component', () => { ...@@ -15,7 +15,7 @@ describe('Badge component', () => {
const buttons = vm.$el.querySelectorAll('button'); const buttons = vm.$el.querySelectorAll('button');
return { return {
badgeImage: vm.$el.querySelector('img.project-badge'), badgeImage: vm.$el.querySelector('img.project-badge'),
loadingIcon: vm.$el.querySelector('.fa-spinner'), loadingIcon: vm.$el.querySelector('.spinner'),
reloadButton: buttons[buttons.length - 1], reloadButton: buttons[buttons.length - 1],
}; };
}; };
......
...@@ -195,7 +195,7 @@ describe('Board list component', () => { ...@@ -195,7 +195,7 @@ describe('Board list component', () => {
component.list.loadingMore = true; component.list.loadingMore = true;
Vue.nextTick(() => { Vue.nextTick(() => {
expect(component.$el.querySelector('.board-list-count .fa-spinner')).not.toBeNull(); expect(component.$el.querySelector('.board-list-count .spinner')).not.toBeNull();
done(); done();
}); });
......
...@@ -194,7 +194,7 @@ describe('Frequent Items App Component', () => { ...@@ -194,7 +194,7 @@ describe('Frequent Items App Component', () => {
expect(loadingEl).toBeDefined(); expect(loadingEl).toBeDefined();
expect(loadingEl.classList.contains('prepend-top-20')).toBe(true); expect(loadingEl.classList.contains('prepend-top-20')).toBe(true);
expect(loadingEl.querySelector('i').getAttribute('aria-label')).toBe('Loading projects'); expect(loadingEl.querySelector('span').getAttribute('aria-label')).toBe('Loading projects');
done(); done();
}); });
}); });
......
...@@ -502,7 +502,7 @@ describe('AppComponent', () => { ...@@ -502,7 +502,7 @@ describe('AppComponent', () => {
vm.isLoading = true; vm.isLoading = true;
Vue.nextTick(() => { Vue.nextTick(() => {
expect(vm.$el.querySelector('.loading-animation')).toBeDefined(); expect(vm.$el.querySelector('.loading-animation')).toBeDefined();
expect(vm.$el.querySelector('i.fa').getAttribute('aria-label')).toBe('Loading groups'); expect(vm.$el.querySelector('span').getAttribute('aria-label')).toBe('Loading groups');
done(); done();
}); });
}); });
......
...@@ -99,7 +99,7 @@ describe('Registry List', () => { ...@@ -99,7 +99,7 @@ describe('Registry List', () => {
it('should render a loading spinner', done => { it('should render a loading spinner', done => {
Vue.nextTick(() => { Vue.nextTick(() => {
expect(vm.$el.querySelector('.fa-spinner')).not.toBe(null); expect(vm.$el.querySelector('.spinner')).not.toBe(null);
done(); done();
}); });
}); });
......
...@@ -61,7 +61,7 @@ describe('Grouped Test Reports App', () => { ...@@ -61,7 +61,7 @@ describe('Grouped Test Reports App', () => {
it('renders success summary text', done => { it('renders success summary text', done => {
setTimeout(() => { setTimeout(() => {
expect(vm.$el.querySelector('.fa-spinner')).not.toBeNull(); expect(vm.$el.querySelector('.spinner')).not.toBeNull();
expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual( expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
'Test summary results are being parsed', 'Test summary results are being parsed',
); );
...@@ -81,7 +81,7 @@ describe('Grouped Test Reports App', () => { ...@@ -81,7 +81,7 @@ describe('Grouped Test Reports App', () => {
it('renders failed summary text + new badge', done => { it('renders failed summary text + new badge', done => {
setTimeout(() => { setTimeout(() => {
expect(vm.$el.querySelector('.fa-spinner')).toBeNull(); expect(vm.$el.querySelector('.spinner')).toBeNull();
expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual( expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
'Test summary contained 2 failed test results out of 11 total tests', 'Test summary contained 2 failed test results out of 11 total tests',
); );
...@@ -109,7 +109,7 @@ describe('Grouped Test Reports App', () => { ...@@ -109,7 +109,7 @@ describe('Grouped Test Reports App', () => {
it('renders summary text', done => { it('renders summary text', done => {
setTimeout(() => { setTimeout(() => {
expect(vm.$el.querySelector('.fa-spinner')).toBeNull(); expect(vm.$el.querySelector('.spinner')).toBeNull();
expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual( expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
'Test summary contained 2 failed test results and 2 fixed test results out of 11 total tests', 'Test summary contained 2 failed test results and 2 fixed test results out of 11 total tests',
); );
...@@ -137,7 +137,7 @@ describe('Grouped Test Reports App', () => { ...@@ -137,7 +137,7 @@ describe('Grouped Test Reports App', () => {
it('renders summary text', done => { it('renders summary text', done => {
setTimeout(() => { setTimeout(() => {
expect(vm.$el.querySelector('.fa-spinner')).toBeNull(); expect(vm.$el.querySelector('.spinner')).toBeNull();
expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual( expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
'Test summary contained 2 fixed test results out of 11 total tests', 'Test summary contained 2 fixed test results out of 11 total tests',
); );
...@@ -190,7 +190,7 @@ describe('Grouped Test Reports App', () => { ...@@ -190,7 +190,7 @@ describe('Grouped Test Reports App', () => {
}); });
it('renders loading summary text with loading icon', done => { it('renders loading summary text with loading icon', done => {
expect(vm.$el.querySelector('.fa-spinner')).not.toBeNull(); expect(vm.$el.querySelector('.spinner')).not.toBeNull();
expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual( expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
'Test summary results are being parsed', 'Test summary results are being parsed',
); );
......
...@@ -18,7 +18,7 @@ describe('MR widget status icon component', () => { ...@@ -18,7 +18,7 @@ describe('MR widget status icon component', () => {
it('renders loading icon', () => { it('renders loading icon', () => {
vm = mountComponent(Component, { status: 'loading' }); vm = mountComponent(Component, { status: 'loading' });
expect(vm.$el.querySelector('.mr-widget-icon i').classList).toContain('fa-spinner'); expect(vm.$el.querySelector('.mr-widget-icon span').classList).toContain('spinner');
}); });
}); });
......
...@@ -38,7 +38,7 @@ describe('MRWidgetAutoMergeFailed', () => { ...@@ -38,7 +38,7 @@ describe('MRWidgetAutoMergeFailed', () => {
Vue.nextTick(() => { Vue.nextTick(() => {
expect(vm.$el.querySelector('button').getAttribute('disabled')).toEqual('disabled'); expect(vm.$el.querySelector('button').getAttribute('disabled')).toEqual('disabled');
expect(vm.$el.querySelector('button i').classList).toContain('fa-spinner'); expect(vm.$el.querySelector('button .loading-container span').classList).toContain('spinner');
done(); done();
}); });
}); });
......
...@@ -20,7 +20,7 @@ describe('MRWidgetChecking', () => { ...@@ -20,7 +20,7 @@ describe('MRWidgetChecking', () => {
}); });
it('renders loading icon', () => { it('renders loading icon', () => {
expect(vm.$el.querySelector('.mr-widget-icon i').classList).toContain('fa-spinner'); expect(vm.$el.querySelector('.mr-widget-icon span').classList).toContain('spinner');
}); });
it('renders information about merging', () => { it('renders information about merging', () => {
......
...@@ -70,12 +70,9 @@ describe('File Icon component', () => { ...@@ -70,12 +70,9 @@ describe('File Icon component', () => {
loading: true, loading: true,
}); });
const { classList } = vm.$el.querySelector('i'); const { classList } = vm.$el.querySelector('.loading-container span');
expect(classList.contains('fa')).toEqual(true); expect(classList.contains('spinner')).toEqual(true);
expect(classList.contains('fa-spin')).toEqual(true);
expect(classList.contains('fa-spinner')).toEqual(true);
expect(classList.contains('fa-1x')).toEqual(true);
}); });
it('should add a special class and a size class', () => { it('should add a special class and a size class', () => {
......
...@@ -88,7 +88,7 @@ describe('Header CI Component', () => { ...@@ -88,7 +88,7 @@ describe('Header CI Component', () => {
vm.actions[0].isLoading = true; vm.actions[0].isLoading = true;
Vue.nextTick(() => { Vue.nextTick(() => {
expect(vm.$el.querySelector('.btn .fa-spinner').getAttribute('style')).toBeFalsy(); expect(vm.$el.querySelector('.btn .spinner').getAttribute('style')).toBeFalsy();
done(); done();
}); });
}); });
......
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