Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(loading): allow html content #18242

Merged
merged 3 commits into from
May 9, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(loading): allow html content
  • Loading branch information
liamdebeasi committed May 9, 2019
commit 7cf04659ba5e5f4f9f0ca9a7e53790bb8e7dc9e1
3 changes: 2 additions & 1 deletion core/src/components/loading/loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component, ComponentInterface, Element, Event, EventEmitter, Listen, Me

import { Animation, AnimationBuilder, Config, Mode, OverlayEventDetail, OverlayInterface, SpinnerTypes } from '../../interface';
import { BACKDROP, dismiss, eventMethod, present } from '../../utils/overlays';
import { sanitizeDOMString } from '../../utils/sanitization';
import { getClassMap } from '../../utils/theme';

import { iosEnterAnimation } from './animations/ios.enter';
Expand Down Expand Up @@ -196,7 +197,7 @@ export class Loading implements ComponentInterface, OverlayInterface {
</div>
)}

{this.message && <div class="loading-content">{this.message}</div>}
{this.message && <div class="loading-content" innerHTML={sanitizeDOMString(this.message)}></div>}
</div>
];
}
Expand Down
8 changes: 8 additions & 0 deletions core/src/components/loading/test/basic/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ test('loading: backdrop standalone', async () => {
await testLoading(DIRECTORY, '#backdrop-loading');
});

test('loading: html content basic', async () => {
await testLoading(DIRECTORY, '#html-content-loading');
});

/**
* RTL Tests
*/
Expand Down Expand Up @@ -53,3 +57,7 @@ test('loading:rtl: custom class basic', async () => {
test('loading:rtl: backdrop standalone', async () => {
await testLoading(DIRECTORY, '#backdrop-loading', true);
});

test('loading:rtl: html content basic', async () => {
await testLoading(DIRECTORY, '#html-content-loading', true);
});
5 changes: 5 additions & 0 deletions core/src/components/loading/test/basic/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<ion-button id="translucent-loading" expand="block" onclick="presentLoadingWithOptions({duration: 5000, message: 'Please wait...', translucent: true})">Show Loading with translucent</ion-button>
<ion-button id="custom-class-loading" expand="block" onclick="presentLoadingWithOptions({duration: 5000,message: 'Please wait...', cssClass: 'custom-class custom-loading'})">Show Loading with cssClass</ion-button>
<ion-button id="backdrop-loading" expand="block" onclick="presentLoadingWithOptions({backdropDismiss: true})">Show Backdrop Click Loading</ion-button>
<ion-button id="html-content-loading" expand="block" onclick="presentLoadingWithOptions({cssClass: 'html-loading', duration: 5000, message: '<ion-button>Click impatiently to load faster</ion-button>'})">Show Loading with HTML content</ion-button>

<ion-loading-controller></ion-loading-controller>

Expand Down Expand Up @@ -82,6 +83,10 @@
</script>

<style>
.html-loading {
--max-width: auto;
}

.custom-loading {
--background: rgba(37, 210, 223, 0.8);
--spinner-color: white;
Expand Down