BREAKING CHANGE
- Pipe factories have been removed.
- PIpe names to pipe implementations are 1-to-1 instead of 1-to-*
Before:
class DateFormatter {
transform(date, args){}
}
class DateFormatterFactory {
supporst(obj) { return true; }
create(cdRef) { return new DateFormatter(); }
}
new Pipes({date: [new DateFormatterFactory()]})
After
class DateFormatter {
transform(date, args){}
}
new Pipes({date: DateFormatter})
37 lines
949 B
TypeScript
37 lines
949 B
TypeScript
import {ddescribe, describe, it, iit, xit, expect, beforeEach, afterEach} from 'angular2/test_lib';
|
|
|
|
import {UpperCasePipe} from 'angular2/src/change_detection/pipes/uppercase_pipe';
|
|
|
|
export function main() {
|
|
describe("UpperCasePipe", () => {
|
|
var upper;
|
|
var lower;
|
|
var pipe;
|
|
|
|
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",
|
|
() => { expect(() => pipe.transform(new Object())).toThrowError(); });
|
|
});
|
|
|
|
});
|
|
}
|