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

Revert "Revert "FIO-7466: Fixed tooltips issue"" #5498

Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/components/_classes/component/Component.js
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@ export default class Component extends Element {
placement: 'right',
zIndex: 10000,
interactive: true,
content: this.t(tooltipText, { _userInput: true }),
content: this.t(this.sanitize(tooltipText), { _userInput: true }),
});
}
});
Expand Down
14 changes: 14 additions & 0 deletions src/components/_classes/component/Component.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { comp1 } from './fixtures';
import _merge from 'lodash/merge';
import comp3 from './fixtures/comp3';
import comp4 from './fixtures/comp4';
import comp5 from './fixtures/comp5';

describe('Component', () => {
it('Should create a Component', (done) => {
Expand Down Expand Up @@ -356,4 +357,17 @@ describe('Component', () => {
.catch(done);
});
});

it('Should not execute code inside Tooltips/Description', (done) => {
const formElement = document.createElement('div');
const form = new Webform(formElement);

form.setForm(comp5).then(() => {
setTimeout(() => {
assert.equal(window._ee, undefined, 'Should not execute code inside Tooltips/Description');
done();
}, 200);
})
.catch(done);
});
});
24 changes: 24 additions & 0 deletions src/components/_classes/component/fixtures/comp5.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export default {
type: 'form',
display: 'form',
components: [
{
label: 'Text Field',
description: "<img <img src='https://somesite' onerror='var _ee = 2' >",
tooltip: "<img src='https://somesite' onerror='var _ee = 1 >",
applyMaskOn: 'change',
tableView: true,
key: 'textField',
type: 'textfield',
input: true
},
{
type: 'button',
label: 'Submit',
key: 'submit',
disableOnInvalid: true,
input: true,
tableView: false
}
],
};
3 changes: 2 additions & 1 deletion src/components/_classes/component/fixtures/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ import comp1 from './comp1';
import comp2 from './comp2';
import comp3 from './comp3';
import comp4 from './comp4';
export { comp1, comp2, comp3, comp4 };
import comp5 from './comp5';
export { comp1, comp2, comp3, comp4, comp5 };
Loading