perf(various): don't use lazy-loaded icon names in components (#24671)

This commit is contained in:
Amanda Smith
2022-01-28 09:13:39 -06:00
committed by GitHub
parent bdb5c421d2
commit 484de5074d
16 changed files with 78 additions and 125 deletions

View File

@ -1,4 +1,5 @@
import { Component, ComponentInterface, Element, Host, Prop, h } from '@stencil/core';
import { arrowBackSharp, chevronBack } from 'ionicons/icons';
import { config } from '../../global/config';
import { getIonMode } from '../../global/ionic-global';
@ -83,11 +84,11 @@ export class BackButton implements ComponentInterface, ButtonInterface {
if (getIonMode(this) === 'ios') {
// default ios back button icon
return config.get('backButtonIcon', 'chevron-back');
return config.get('backButtonIcon', chevronBack);
}
// default md back button icon
return config.get('backButtonIcon', 'arrow-back-sharp');
return config.get('backButtonIcon', arrowBackSharp);
}
get backButtonText() {

View File

@ -1,3 +1,5 @@
import { arrowBackSharp, chevronBack } from 'ionicons/icons';
import { newSpecPage } from '@stencil/core/testing';
import { BackButton } from "../back-button";
import { config } from "../../../global/config";
@ -46,12 +48,12 @@ describe('back button', () => {
it('default icon for ios mode', async () => {
const bb = await newBackButton('ios');
expect(bb.backButtonIcon).toBe('chevron-back');
expect(bb.backButtonIcon).toBe(chevronBack);
});
it('default icon', async () => {
const bb = await newBackButton();
expect(bb.backButtonIcon).toBe('arrow-back-sharp');
expect(bb.backButtonIcon).toBe(arrowBackSharp);
});
});