2016-06-23 12:47:54 -04:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
2016-04-28 20:50:03 -04:00
|
|
|
import {UpperCasePipe} from '@angular/common';
|
2016-09-27 20:12:25 -04:00
|
|
|
import {beforeEach, describe, expect, it} from '@angular/core/testing/testing_internal';
|
2015-05-14 13:14:26 -04:00
|
|
|
|
|
|
|
export function main() {
|
2016-06-08 19:38:52 -04:00
|
|
|
describe('UpperCasePipe', () => {
|
2016-11-12 08:08:58 -05:00
|
|
|
let upper: string;
|
|
|
|
let lower: string;
|
|
|
|
let pipe: UpperCasePipe;
|
2015-05-14 13:14:26 -04:00
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
lower = 'something';
|
|
|
|
upper = 'SOMETHING';
|
|
|
|
pipe = new UpperCasePipe();
|
|
|
|
});
|
|
|
|
|
2016-06-08 19:38:52 -04:00
|
|
|
describe('transform', () => {
|
2015-05-14 13:14:26 -04:00
|
|
|
|
2016-06-08 19:38:52 -04:00
|
|
|
it('should return uppercase', () => {
|
2016-11-12 08:08:58 -05:00
|
|
|
const val = pipe.transform(lower);
|
2015-05-14 13:14:26 -04:00
|
|
|
expect(val).toEqual(upper);
|
|
|
|
});
|
|
|
|
|
2016-06-08 19:38:52 -04:00
|
|
|
it('should uppercase when there is a new value', () => {
|
2016-11-12 08:08:58 -05:00
|
|
|
const val = pipe.transform(lower);
|
2015-05-14 13:14:26 -04:00
|
|
|
expect(val).toEqual(upper);
|
2016-11-12 08:08:58 -05:00
|
|
|
const val2 = pipe.transform('wat');
|
2015-05-14 13:14:26 -04:00
|
|
|
expect(val2).toEqual('WAT');
|
|
|
|
});
|
|
|
|
|
2016-06-08 19:38:52 -04:00
|
|
|
it('should not support other objects',
|
2016-06-17 13:57:32 -04:00
|
|
|
() => { expect(() => pipe.transform(<any>{})).toThrowError(); });
|
2015-05-14 13:14:26 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|