Skip to content

Commit 7842e99

Browse files
Blackbaud-ColbyWhiteBobby Earl
and
Bobby Earl
committed
feat: move help logic into latest lib-help (blackbaud#190)
* feat: move help logic into latest lib-help * feat: use 3.2.0 version of lib-help * refactor: remove unused host var Co-authored-by: Bobby Earl <bobby.earl@blackbaud.com>
1 parent 95f8669 commit 7842e99

File tree

4 files changed

+7
-87
lines changed

4 files changed

+7
-87
lines changed

package-lock.json

+6-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"dependencies": {
6060
"@angular-devkit/build-optimizer": "0.13.9",
6161
"@blackbaud/help-client": "2.1.0",
62-
"@blackbaud/skyux-lib-help": "3.1.2",
62+
"@blackbaud/skyux-lib-help": "3.2.0",
6363
"@blackbaud/skyux-logger": "1.1.1",
6464
"@ngtools/webpack": "7.3.9",
6565
"@pact-foundation/karma-pact": "2.2.0",

src/app/app.component.spec.ts

-65
Original file line numberDiff line numberDiff line change
@@ -705,71 +705,6 @@ describe('AppComponent', () => {
705705
});
706706
}));
707707

708-
it('should assign help config extends key to the svcid if one exists', async(() => {
709-
const spyHelp = spyOn(mockHelpInitService, 'load');
710-
const expectedCall = { productId: 'test-config', extends: 'help-extend' };
711-
skyAppConfig.skyux.help = { productId: 'test-config' };
712-
713-
skyAppConfig.skyux.params = ['svcid'];
714-
skyAppConfig.runtime.params.has = (key: any) => key === 'svcid';
715-
skyAppConfig.runtime.params.get = (key: any) => key === 'svcid' ? 'help-extend' : false;
716-
717-
setup(skyAppConfig).then(() => {
718-
fixture.detectChanges();
719-
expect(spyHelp).not.toHaveBeenCalledWith(skyAppConfig.skyux.help);
720-
expect(spyHelp).toHaveBeenCalledWith(expectedCall);
721-
});
722-
}));
723-
724-
it('should assign help config locale key if none exist and host exposes the browser language', async(() => {
725-
const spyHelp = spyOn(mockHelpInitService, 'load');
726-
727-
skyAppConfig.runtime.params.has = (key: any) => key === false;
728-
729-
mockSkyuxHost = {
730-
acceptLanguage: 'fr-ca'
731-
};
732-
const expectedCall = { productId: 'test-config', extends: 'bb-help', locale: mockSkyuxHost.acceptLanguage };
733-
skyAppConfig.skyux.help = { productId: 'test-config', extends: 'bb-help' };
734-
735-
setup(skyAppConfig).then(() => {
736-
fixture.detectChanges();
737-
expect(spyHelp).not.toHaveBeenCalledWith(skyAppConfig.skyux.help);
738-
expect(spyHelp).toHaveBeenCalledWith(expectedCall);
739-
});
740-
}));
741-
742-
it('should fallback to \'\' for the locale if SKYUX_HOST.acceptLanguage does not exist', async(() => {
743-
const spyHelp = spyOn(mockHelpInitService, 'load');
744-
745-
skyAppConfig.runtime.params.has = (key: any) => key === false;
746-
747-
mockSkyuxHost = {};
748-
const expectedCall = { productId: 'test-config', extends: 'bb-help', locale: '' };
749-
skyAppConfig.skyux.help = { productId: 'test-config', extends: 'bb-help' };
750-
751-
setup(skyAppConfig).then(() => {
752-
fixture.detectChanges();
753-
expect(spyHelp).not.toHaveBeenCalledWith(skyAppConfig.skyux.help);
754-
expect(spyHelp).toHaveBeenCalledWith(expectedCall);
755-
});
756-
}));
757-
758-
it('should not override a locale that has been passed into the config', async(() => {
759-
const spyHelp = spyOn(mockHelpInitService, 'load');
760-
mockSkyuxHost = {
761-
acceptLanguage: 'fr-ca'
762-
};
763-
const expectedCall = { productId: 'test-config', extends: 'bb-help', locale: 'en-ga' };
764-
skyAppConfig.skyux.help = { productId: 'test-config', extends: 'bb-help', locale: 'en-ga' };
765-
766-
setup(skyAppConfig).then(() => {
767-
fixture.detectChanges();
768-
expect(spyHelp).toHaveBeenCalledWith(skyAppConfig.skyux.help);
769-
expect(spyHelp).toHaveBeenCalledWith(expectedCall);
770-
});
771-
}));
772-
773708
it('should set isReady after SkyAppStyleLoader.loadStyles is resolved', async(() => {
774709
setup(skyAppConfig).then(() => {
775710
expect(comp.isReady).toEqual(true);

src/app/app.component.ts

-10
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ export class AppComponent implements OnInit, OnDestroy {
252252
private initShellComponents() {
253253
const omnibarConfig = this.config.skyux.omnibar;
254254
const helpConfig = this.config.skyux.help;
255-
const skyuxHost = (this.windowRef.nativeWindow as any).SKYUX_HOST;
256255

257256
const loadOmnibar = (args?: SkyAppOmnibarReadyArgs) => {
258257
this.setParamsFromQS(omnibarConfig);
@@ -294,15 +293,6 @@ export class AppComponent implements OnInit, OnDestroy {
294293
}
295294

296295
if (helpConfig && this.helpInitService) {
297-
if (this.config.runtime.params.has('svcid')) {
298-
helpConfig.extends = this.config.runtime.params.get('svcid');
299-
}
300-
301-
if (skyuxHost && !helpConfig.locale) {
302-
const browserLanguages = skyuxHost.acceptLanguage || '';
303-
helpConfig.locale = browserLanguages.split(',')[0];
304-
}
305-
306296
this.helpInitService.load(helpConfig);
307297
}
308298
}

0 commit comments

Comments
 (0)