Updated specs
This commit is contained in:
parent
c0af1fc4be
commit
b24cb99856
7 changed files with 12 additions and 13 deletions
|
@ -381,7 +381,7 @@
|
|||
url: pageUrl,
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
if (data && data.icon) {
|
||||
if (data && data.favicon) {
|
||||
gl.utils.setFavicon(data.favicon);
|
||||
} else {
|
||||
gl.utils.resetFavicon();
|
||||
|
|
|
@ -60,7 +60,7 @@ describe Projects::BuildsController do
|
|||
expect(json_response['text']).to eq status.text
|
||||
expect(json_response['label']).to eq status.label
|
||||
expect(json_response['icon']).to eq status.icon
|
||||
expect(json_response['favicon']).to eq status.favicon
|
||||
expect(json_response['favicon']).to match status.favicon
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1208,7 +1208,7 @@ describe Projects::MergeRequestsController do
|
|||
expect(json_response['text']).to eq status.text
|
||||
expect(json_response['label']).to eq status.label
|
||||
expect(json_response['icon']).to eq status.icon
|
||||
expect(json_response['favicon']).to eq status.favicon
|
||||
expect(json_response['favicon']).to match status.favicon
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ describe Projects::PipelinesController do
|
|||
expect(json_response['text']).to eq status.text
|
||||
expect(json_response['label']).to eq status.label
|
||||
expect(json_response['icon']).to eq status.icon
|
||||
expect(json_response['favicon']).to eq status.favicon
|
||||
expect(json_response['favicon']).to match status.favicon
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -313,7 +313,7 @@ require('~/lib/utils/common_utils');
|
|||
|
||||
describe('gl.utils.setFavicon', () => {
|
||||
it('should set page favicon to provided favicon', () => {
|
||||
const faviconName = 'custom_favicon';
|
||||
const faviconPath = '//custom_favicon';
|
||||
const fakeLink = {
|
||||
setAttribute() {},
|
||||
};
|
||||
|
@ -321,9 +321,9 @@ require('~/lib/utils/common_utils');
|
|||
spyOn(window.document, 'getElementById').and.callFake(() => fakeLink);
|
||||
spyOn(fakeLink, 'setAttribute').and.callFake((attr, val) => {
|
||||
expect(attr).toEqual('href');
|
||||
expect(val.indexOf('/assets/custom_favicon.ico') > -1).toBe(true);
|
||||
expect(val.indexOf(faviconPath) > -1).toBe(true);
|
||||
});
|
||||
gl.utils.setFavicon(faviconName);
|
||||
gl.utils.setFavicon(faviconPath);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -345,13 +345,12 @@ require('~/lib/utils/common_utils');
|
|||
describe('gl.utils.setCiStatusFavicon', () => {
|
||||
it('should set page favicon to CI status favicon based on provided status', () => {
|
||||
const BUILD_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/builds/1/status.json`;
|
||||
const FAVICON_PATH = 'ci_favicons/';
|
||||
const FAVICON = 'icon_status_success';
|
||||
const FAVICON_PATH = '//icon_status_success';
|
||||
const spySetFavicon = spyOn(gl.utils, 'setFavicon').and.stub();
|
||||
const spyResetFavicon = spyOn(gl.utils, 'resetFavicon').and.stub();
|
||||
spyOn($, 'ajax').and.callFake(function (options) {
|
||||
options.success({ icon: FAVICON });
|
||||
expect(spySetFavicon).toHaveBeenCalledWith(FAVICON_PATH + FAVICON);
|
||||
options.success({ favicon: FAVICON_PATH });
|
||||
expect(spySetFavicon).toHaveBeenCalledWith(FAVICON_PATH);
|
||||
options.success();
|
||||
expect(spyResetFavicon).toHaveBeenCalled();
|
||||
options.error();
|
||||
|
|
|
@ -38,7 +38,7 @@ describe BuildSerializer do
|
|||
expect(subject[:text]).to eq(status.text)
|
||||
expect(subject[:label]).to eq(status.label)
|
||||
expect(subject[:icon]).to eq(status.icon)
|
||||
expect(subject[:favicon]).to eq(status.favicon)
|
||||
expect(subject[:favicon]).to match status.favicon
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -144,7 +144,7 @@ describe PipelineSerializer do
|
|||
expect(subject[:text]).to eq(status.text)
|
||||
expect(subject[:label]).to eq(status.label)
|
||||
expect(subject[:icon]).to eq(status.icon)
|
||||
expect(subject[:favicon]).to eq(status.favicon)
|
||||
expect(subject[:favicon]).to match status.favicon
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue