Convert Whisper.View
tests to TypeScript
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
// Copyright 2015-2020 Signal Messenger, LLC
|
// Copyright 2015-2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
/* global Whisper */
|
import { assert } from 'chai';
|
||||||
|
|
||||||
describe('Whisper.View', () => {
|
describe('Whisper.View', () => {
|
||||||
it('renders a template with render_attributes', () => {
|
it('renders a template with render_attributes', () => {
|
||||||
const ViewClass = Whisper.View.extend({
|
const ViewClass = window.Whisper.View.extend({
|
||||||
template: '<div>{{ variable }}</div>',
|
template: '<div>{{ variable }}</div>',
|
||||||
render_attributes: {
|
render_attributes: {
|
||||||
variable: 'value',
|
variable: 'value',
|
||||||
@@ -17,7 +17,7 @@ describe('Whisper.View', () => {
|
|||||||
assert.strictEqual(view.$el.html(), '<div>value</div>');
|
assert.strictEqual(view.$el.html(), '<div>value</div>');
|
||||||
});
|
});
|
||||||
it('renders a template with no render_attributes', () => {
|
it('renders a template with no render_attributes', () => {
|
||||||
const ViewClass = Whisper.View.extend({
|
const ViewClass = window.Whisper.View.extend({
|
||||||
template: '<div>static text</div>',
|
template: '<div>static text</div>',
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ describe('Whisper.View', () => {
|
|||||||
assert.strictEqual(view.$el.html(), '<div>static text</div>');
|
assert.strictEqual(view.$el.html(), '<div>static text</div>');
|
||||||
});
|
});
|
||||||
it('renders a template function with render_attributes function', () => {
|
it('renders a template function with render_attributes function', () => {
|
||||||
const ViewClass = Whisper.View.extend({
|
const ViewClass = window.Whisper.View.extend({
|
||||||
template() {
|
template() {
|
||||||
return '<div>{{ variable }}</div>';
|
return '<div>{{ variable }}</div>';
|
||||||
},
|
},
|
Reference in New Issue
Block a user