mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
chore(): sync with main
This commit is contained in:
40
core/src/components/loading/test/loading.spec.ts
Normal file
40
core/src/components/loading/test/loading.spec.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { newSpecPage } from '@stencil/core/testing';
|
||||
import { Loading } from '../loading';
|
||||
import { config } from '../../../global/config';
|
||||
|
||||
describe('alert: custom html', () => {
|
||||
it('should allow for custom html by default', async () => {
|
||||
const page = await newSpecPage({
|
||||
components: [Loading],
|
||||
html: `<ion-loading message="<button class='custom-html'>Custom Text</button>"></ion-loading>`,
|
||||
});
|
||||
|
||||
const content = page.body.querySelector('.loading-content');
|
||||
expect(content.textContent).toContain('Custom Text');
|
||||
expect(content.querySelector('button.custom-html')).not.toBe(null);
|
||||
});
|
||||
|
||||
it('should allow for custom html', async () => {
|
||||
config.reset({ innerHTMLTemplatesEnabled: true });
|
||||
const page = await newSpecPage({
|
||||
components: [Loading],
|
||||
html: `<ion-loading message="<button class='custom-html'>Custom Text</button>"></ion-loading>`,
|
||||
});
|
||||
|
||||
const content = page.body.querySelector('.loading-content');
|
||||
expect(content.textContent).toContain('Custom Text');
|
||||
expect(content.querySelector('button.custom-html')).not.toBe(null);
|
||||
});
|
||||
|
||||
it('should not allow for custom html', async () => {
|
||||
config.reset({ innerHTMLTemplatesEnabled: false });
|
||||
const page = await newSpecPage({
|
||||
components: [Loading],
|
||||
html: `<ion-loading message="<button class='custom-html'>Custom Text</button>"></ion-loading>`,
|
||||
});
|
||||
|
||||
const content = page.body.querySelector('.loading-content');
|
||||
expect(content.textContent).toContain('Custom Text');
|
||||
expect(content.querySelector('button.custom-html')).toBe(null);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user