-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtests.js
34 lines (25 loc) · 882 Bytes
/
tests.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
'use strict';
describe('nl2br-filter', function () {
var $filter;
beforeEach(function () {
module('nl2br-filter');
inject(function (_$filter_) {
$filter = _$filter_;
});
});
it('should escape HTML', function () {
var testStr = '<script></script>';
var result = $filter('nl2br')(testStr);
expect(result.$$unwrapTrustedValue()).toEqual('<script></script>');
});
it('should convert newlines to <br>-tags', function () {
var testStr = 'row1\nrow2';
var result = $filter('nl2br')(testStr);
expect(result.$$unwrapTrustedValue()).toEqual('row1<br>row2');
});
it('should return `undefined` if the input is undefined', function () {
var testStr;
var result = $filter('nl2br')(testStr);
expect(result).toBeUndefined();
});
});