Skip to content

Commit

Permalink
Merge pull request #99 from ymmooot/fix_for_nuxt2.9
Browse files Browse the repository at this point in the history
fix: bug that jsonlds are sanitized with nuxt2.9
  • Loading branch information
ymmooot authored Aug 20, 2019
2 parents 8fdf26e + cb976f0 commit 7cc4ad5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/createMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface JsonldConfig {
innerHTML: string;
}[];
__dangerouslyDisableSanitizersByTagID?: {
[key: string]: 'innerHTML';
[key: string]: ['innerHTML'];
};
}

Expand Down Expand Up @@ -51,7 +51,7 @@ export default (options: Options = {}): JsonldMixin => {
},
],
__dangerouslyDisableSanitizersByTagID: {
[hid]: 'innerHTML',
[hid]: ['innerHTML'],
},
};
},
Expand Down
10 changes: 5 additions & 5 deletions test/createMixin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('with jsonld', () => {

expect(mock.$options.head.call(mock)).toEqual({
__dangerouslyDisableSanitizersByTagID: {
'nuxt-jsonld-8251e634': 'innerHTML',
'nuxt-jsonld-8251e634': ['innerHTML'],
},
script: [
{
Expand Down Expand Up @@ -101,7 +101,7 @@ describe('with jsonld', () => {

expect(mock.$options.head.call(mock)).toEqual({
__dangerouslyDisableSanitizersByTagID: {
'nuxt-jsonld-a36cc3c0': 'innerHTML',
'nuxt-jsonld-a36cc3c0': ['innerHTML'],
},
script: [
{
Expand Down Expand Up @@ -138,7 +138,7 @@ describe('with jsonld', () => {

expect(mock.$options.head.call(mock)).toEqual({
__dangerouslyDisableSanitizersByTagID: {
'nuxt-jsonld-5414b96e': 'innerHTML',
'nuxt-jsonld-5414b96e': ['innerHTML'],
},
script: [
{
Expand Down Expand Up @@ -191,7 +191,7 @@ describe('hid', () => {
expect(actual).toEqual([
{
__dangerouslyDisableSanitizersByTagID: {
'nuxt-jsonld-4e298139': 'innerHTML',
'nuxt-jsonld-4e298139': ['innerHTML'],
},
script: [
{
Expand All @@ -203,7 +203,7 @@ describe('hid', () => {
},
{
__dangerouslyDisableSanitizersByTagID: {
'nuxt-jsonld-90d62c9': 'innerHTML',
'nuxt-jsonld-90d62c9': ['innerHTML'],
},
script: [
{
Expand Down
8 changes: 4 additions & 4 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,19 @@ describe('merge strategy', () => {
test('object already has __dangerouslyDisableSanitizersByTagID', () => {
const from = {
__dangerouslyDisableSanitizersByTagID: {
foo: 'innerHTML',
foo: ['innerHTML'],
},
};
const to = {
__dangerouslyDisableSanitizersByTagID: {
bar: 'innerHTML',
bar: ['innerHTML'],
},
};
const resFunc = jsonld.mergeStrategy(to, from);
expect(resFunc()).toEqual({
__dangerouslyDisableSanitizersByTagID: {
foo: 'innerHTML',
bar: 'innerHTML',
foo: ['innerHTML'],
bar: ['innerHTML'],
},
});
});
Expand Down

0 comments on commit 7cc4ad5

Please sign in to comment.