Convert Whisper.View
tests to TypeScript
This commit is contained in:
parent
17389f4e01
commit
d3f9b656dd
1 changed files with 5 additions and 5 deletions
|
@ -1,41 +0,0 @@
|
|||
// Copyright 2015-2020 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
/* global Whisper */
|
||||
|
||||
describe('Whisper.View', () => {
|
||||
it('renders a template with render_attributes', () => {
|
||||
const ViewClass = Whisper.View.extend({
|
||||
template: '<div>{{ variable }}</div>',
|
||||
render_attributes: {
|
||||
variable: 'value',
|
||||
},
|
||||
});
|
||||
|
||||
const view = new ViewClass();
|
||||
view.render();
|
||||
assert.strictEqual(view.$el.html(), '<div>value</div>');
|
||||
});
|
||||
it('renders a template with no render_attributes', () => {
|
||||
const ViewClass = Whisper.View.extend({
|
||||
template: '<div>static text</div>',
|
||||
});
|
||||
|
||||
const view = new ViewClass();
|
||||
view.render();
|
||||
assert.strictEqual(view.$el.html(), '<div>static text</div>');
|
||||
});
|
||||
it('renders a template function with render_attributes function', () => {
|
||||
const ViewClass = Whisper.View.extend({
|
||||
template() {
|
||||
return '<div>{{ variable }}</div>';
|
||||
},
|
||||
render_attributes() {
|
||||
return { variable: 'value' };
|
||||
},
|
||||
});
|
||||
const view = new ViewClass();
|
||||
view.render();
|
||||
assert.strictEqual(view.$el.html(), '<div>value</div>');
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue