fix(many): innerHTML is disabled by default (#27029)

BREAKING CHANGE:

The `innerHTMLTemplatesEnabled` Ionic Config now defaults to `false`. Developers can set this option to `true` if they would like to continue to use custom HTML features in `ion-alert`, `ion-infinite-scroll-content`, `ion-loading`, `ion-refresher-content`, and `ion-toast`.
This commit is contained in:
Liam DeBeasi
2023-03-27 12:07:00 -04:00
committed by GitHub
parent b148384a13
commit b7e46038e0
10 changed files with 35 additions and 12 deletions

View File

@ -3,7 +3,7 @@ import { Alert } from '../alert';
import { config } from '../../../global/config';
describe('alert: custom html', () => {
it('should allow for custom html by default', async () => {
it('should not allow for custom html by default', async () => {
const page = await newSpecPage({
components: [Alert],
html: `<ion-alert message="<button class='custom-html'>Custom Text</button>"></ion-alert>`,
@ -11,7 +11,7 @@ describe('alert: custom html', () => {
const content = page.body.querySelector('.alert-message');
expect(content.textContent).toContain('Custom Text');
expect(content.querySelector('button.custom-html')).not.toBe(null);
expect(content.querySelector('button.custom-html')).toBe(null);
});
it('should allow for custom html', async () => {

View File

@ -58,6 +58,12 @@
</ion-app>
<script>
window.Ionic = {
config: {
innerHTMLTemplatesEnabled: true,
},
};
async function openAlert(opts) {
const alert = await alertController.create(opts);
await alert.present();