angular-cn/modules/@angular/common/test/pipes/uppercase_pipe_spec.ts

36 lines
960 B
TypeScript
Raw Normal View History

import {UpperCasePipe} from '@angular/common';
import {afterEach, beforeEach, ddescribe, describe, expect, iit, it, xit} from '@angular/core/testing/testing_internal';
export function main() {
describe('UpperCasePipe', () => {
2016-06-17 13:57:32 -04:00
var upper: string;
var lower: string;
var pipe: UpperCasePipe;
beforeEach(() => {
lower = 'something';
upper = 'SOMETHING';
pipe = new UpperCasePipe();
});
describe('transform', () => {
it('should return uppercase', () => {
var val = pipe.transform(lower);
expect(val).toEqual(upper);
});
it('should uppercase when there is a new value', () => {
var val = pipe.transform(lower);
expect(val).toEqual(upper);
var val2 = pipe.transform('wat');
expect(val2).toEqual('WAT');
});
it('should not support other objects',
2016-06-17 13:57:32 -04:00
() => { expect(() => pipe.transform(<any>{})).toThrowError(); });
});
});
}