-
Notifications
You must be signed in to change notification settings - Fork 13.4k
feat(config): add option to disable custom html functionality #26956
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
44c13be
feat(config): add option to disable html functionality
liamdebeasi 7fa3d82
chore(): update docs
liamdebeasi 1c2b6a0
implement in infinite-scroll-content
liamdebeasi 7bf8db4
implement for refresher-content
liamdebeasi a96f8b8
lint
liamdebeasi efb832a
clean up
liamdebeasi 2764308
implement for alert
liamdebeasi d2f930c
implement for loading
liamdebeasi c697d06
implement for toast
liamdebeasi 4601afa
add test cases for true config
liamdebeasi f13d4fe
refactor(): rename to enableInnerHTMLTemplates
liamdebeasi 430e6b9
refactor(): rename to innerHTMLTemplatesEnabled
liamdebeasi 2d4c9d0
Merge branch 'feature-6.7' into FW-3722
liamdebeasi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { newSpecPage } from '@stencil/core/testing'; | ||
import { Alert } from '../alert'; | ||
import { config } from '../../../global/config'; | ||
|
||
describe('alert: custom html', () => { | ||
it('should 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>`, | ||
}); | ||
|
||
const content = page.body.querySelector('.alert-message'); | ||
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: [Alert], | ||
html: `<ion-alert message="<button class='custom-html'>Custom Text</button>"></ion-alert>`, | ||
}); | ||
|
||
const content = page.body.querySelector('.alert-message'); | ||
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: [Alert], | ||
html: `<ion-alert message="<button class='custom-html'>Custom Text</button>"></ion-alert>`, | ||
}); | ||
|
||
const content = page.body.querySelector('.alert-message'); | ||
expect(content.textContent).toContain('Custom Text'); | ||
expect(content.querySelector('button.custom-html')).toBe(null); | ||
}); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
core/src/components/infinite-scroll-content/test/infinite-scroll-content.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { newSpecPage } from '@stencil/core/testing'; | ||
import { InfiniteScrollContent } from '../infinite-scroll-content'; | ||
import { config } from '../../../global/config'; | ||
|
||
describe('infinite-scroll-content: custom html', () => { | ||
it('should allow for custom html by default', async () => { | ||
const page = await newSpecPage({ | ||
components: [InfiniteScrollContent], | ||
html: `<ion-infinite-scroll-content loading-text="<button class='custom-html'>Custom Text</button>"></ion-infinite-scroll-content>`, | ||
}); | ||
|
||
const content = page.body.querySelector('.infinite-loading-text'); | ||
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: [InfiniteScrollContent], | ||
html: `<ion-infinite-scroll-content loading-text="<button class='custom-html'>Custom Text</button>"></ion-infinite-scroll-content>`, | ||
}); | ||
|
||
const content = page.body.querySelector('.infinite-loading-text'); | ||
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: [InfiniteScrollContent], | ||
html: `<ion-infinite-scroll-content loading-text="<button class='custom-html'>Custom Text2</button>"></ion-infinite-scroll-content>`, | ||
}); | ||
|
||
const content = page.body.querySelector('.infinite-loading-text'); | ||
expect(content.textContent).toContain('Custom Text'); | ||
expect(content.querySelector('button.custom-html')).toBe(null); | ||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.