Summary Table
| Categories |
Total Count |
| PII |
0 |
| URL |
0 |
| DNS |
0 |
| EKL |
0 |
| IP |
0 |
| PORT |
0 |
| VsID |
0 |
| CF |
0 |
| AI |
0 |
| VPD |
0 |
| PL |
0 |
| Other |
0 |
File Content
define(['limitLength'], function() {
'use strict';
describe("limitLength filter", function () {
var limitLength;
beforeEach(function () {
module('angularTemplateApp');
inject(function(limitLengthFilter) {
limitLength = limitLengthFilter;
});
});
it('should not truncate shorter strings', function() {
expect(limitLength('Hello world', 20)).toBe('Hello world');
});
it('should truncate on word boundaries', function() {
expect(limitLength('Hello world', 10)).toBe('Hello…');
});
it('should truncate long words at the limit', function() {
expect(limitLength('Supercalifragilisticexpialidocious', 10)).toBe('Supercalif…');
});
it('should preserve substrings', function() {
expect(limitLength('Hello world', 10, 'world')).toBe('He…world');
});
it('should preserve substrings and prefixes where possible', function() {
expect(limitLength('Hello dear world', 15, 'world')).toBe('Hello…world');
});
it('should preserve substrings with an end ellipsis where appropriate', function() {
expect(limitLength('Hello my dear world', 16, 'dear')).toBe('Hello my dear…');
});
it('should preserve substrings with an end ellipsis where appropriate', function() {
expect(limitLength('Hello my fabulous dear world', 15, 'dear')).toBe('Hello…dear…');
});
it('should preserve substrings as entire words', function() {
expect(limitLength('Hello my fabulous dear world', 15, 'ear')).toBe('Hello…dear…');
});
});
});