Skip to content

Commit

Permalink
Merge pull request #200 from as-ideas/#191-oil-shown
Browse files Browse the repository at this point in the history
#191 oil shown
  • Loading branch information
ltparis2018 committed Aug 17, 2018
2 parents 3b04165 + 9c61991 commit a826033
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/scripts/core/core_oil.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { logError, logInfo, logPreviewInfo } from './core_log';
import { checkOptIn } from './core_optin';
import { getSoiCookie, isBrowserCookieEnabled, isPreviewCookieSet, removePreviewCookie, removeVerboseCookie, setPreviewCookie, setVerboseCookie } from './core_cookies';
import { doSetTealiumVariables } from './core_tealium_loading_rules';
import { getLocale, isPreviewMode, resetConfiguration, setGdprApplies } from './core_config';
import { EVENT_NAME_HAS_OPTED_IN, EVENT_NAME_NO_COOKIES_ALLOWED, EVENT_NAME_OIL_SHOWN } from './core_constants';
import { getLocale, isPreviewMode, resetConfiguration, setGdprApplies} from './core_config';
import { EVENT_NAME_HAS_OPTED_IN, EVENT_NAME_NO_COOKIES_ALLOWED } from './core_constants';
import { executeCommandCollection } from './core_command_collection';
import { manageDomElementActivation } from './core_tag_management';

Expand Down Expand Up @@ -69,7 +69,6 @@ export function initOilLayer() {
.catch((e) => {
logError('Locale could not be loaded.', e);
});
sendEventToHostSite(EVENT_NAME_OIL_SHOWN);
}
});
}
Expand Down
3 changes: 2 additions & 1 deletion src/scripts/userview/userview_modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
EVENT_NAME_ADVANCED_SETTINGS,
EVENT_NAME_AS_PRIVACY_SELECTED,
EVENT_NAME_BACK_TO_MAIN,
EVENT_NAME_COMPANY_LIST,
EVENT_NAME_COMPANY_LIST, EVENT_NAME_OIL_SHOWN,
EVENT_NAME_POI_OPT_IN,
EVENT_NAME_SOI_OPT_IN,
EVENT_NAME_THIRD_PARTY_LIST,
Expand Down Expand Up @@ -62,6 +62,7 @@ export function renderOil(props) {
startTimeOut();
renderOilContentToWrapper(oilDefaultTemplate());
}
sendEventToHostSite(EVENT_NAME_OIL_SHOWN);
} else {
removeOilWrapperFromDOM();
}
Expand Down
1 change: 0 additions & 1 deletion test/specs/core/core_oil.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,4 @@ describe('core_oil', () => {
},
2000);
});

});
12 changes: 12 additions & 0 deletions test/specs/userview/userview_modal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { resetOil } from '../../test-utils/utils_reset';
import * as AdvancedSettingsStandard from '../../../src/scripts/userview/view/oil.advanced.settings.standard';
import * as AdvancedSettingsTabs from '../../../src/scripts/userview/view/oil.advanced.settings.tabs';
import * as CoreLog from '../../../src/scripts/core/core_log';
import * as CoreConfig from '../../../src/scripts/core/core_config';
import * as CoreUtils from '../../../src/scripts/core/core_utils';
import {EVENT_NAME_OIL_SHOWN} from '../../../src/scripts/core/core_constants';

describe('the user view modal aka the oil layer wrapper', () => {

Expand Down Expand Up @@ -116,6 +119,15 @@ describe('the user view modal aka the oil layer wrapper', () => {
expect(CoreLog.logError).toHaveBeenCalled();
expect(CoreLog.logError.calls.mostRecent().args[0]).toMatch(/^Found unknown CPC type 'invalidCpcType'/)
});

it('should not execute oil_shown event if gdpr_applies is FALSE', (done) => {
spyOn(CoreConfig, 'gdprApplies').and.returnValue(false);
spyOn(CoreUtils, 'sendEventToHostSite').and.callThrough();

renderOil({optIn: false, advancedSettings: true});
expect(CoreUtils.sendEventToHostSite).not.toHaveBeenCalledWith(EVENT_NAME_OIL_SHOWN);
done();
});
});

function expectTimeoutNotStarted() {
Expand Down

0 comments on commit a826033

Please sign in to comment.