mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
add test to check that user name is properly escaped
This commit is contained in:
23
test/spec/ui/account.js
Normal file
23
test/spec/ui/account.js
Normal file
@@ -0,0 +1,23 @@
|
||||
describe('iD.uiAccount', function () {
|
||||
it('properly escapes user name', function() {
|
||||
var selection = d3.select('body').append('div');
|
||||
var osmConnectionMock = {
|
||||
authenticated: () => true,
|
||||
userDetails: (callback) => {
|
||||
callback(null, {
|
||||
display_name: 'x<br>y'
|
||||
});
|
||||
},
|
||||
userURL: () => '',
|
||||
on: (handler, callback) => {
|
||||
if (handler === 'change.account') {
|
||||
onChangeAccountHandler = callback;
|
||||
}
|
||||
}
|
||||
};
|
||||
var onChangeAccountHandler;
|
||||
iD.uiAccount({ connection: () => osmConnectionMock })(selection);
|
||||
onChangeAccountHandler.call();
|
||||
expect(selection.select('.userInfo span.label').text()).to.equal('x<br>y');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user