Init.
This commit is contained in:
parent
0d3cc37f19
commit
c7d7c92522
7 changed files with 3368 additions and 0 deletions
42
spec/KiwiSpec.js
Normal file
42
spec/KiwiSpec.js
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
describe('Kiwi.compose', function() {
|
||||
it('should return the input string',function() {
|
||||
var input = "text without interpolation";
|
||||
expect(Kiwi.compose(input)).toEqual(input);
|
||||
});
|
||||
|
||||
it('should return replace %s with text', function() {
|
||||
var input = "There are % apples";
|
||||
var result = "There are five apples";
|
||||
expect(Kiwi.compose(input, ["five"])).toEqual(result);
|
||||
});
|
||||
|
||||
it('should return replace % with text when % is last', function() {
|
||||
var input = "There are five %";
|
||||
var result = "There are five apples";
|
||||
expect(Kiwi.compose(input, ["apples"])).toEqual(result);
|
||||
});
|
||||
|
||||
it('should return replace % when input is %', function() {
|
||||
var input = "%";
|
||||
var result = "There are five apples";
|
||||
expect(Kiwi.compose(input, [result])).toEqual(result);
|
||||
});
|
||||
|
||||
it('should return replace 2 %s when input has 2 %s', function() {
|
||||
var input = "There are % %";
|
||||
var result = "There are five apples";
|
||||
expect(Kiwi.compose(input, ["five", "apples"])).toEqual(result);
|
||||
});
|
||||
|
||||
it('should return replace 2 %s when input has 2 %s', function() {
|
||||
var input = "% are % apples";
|
||||
var result = "There are five apples";
|
||||
expect(Kiwi.compose(input, ["There", "five"])).toEqual(result);
|
||||
});
|
||||
|
||||
it('should return escaped %', function() {
|
||||
var input = "The % is 2.3`%";
|
||||
var result = "The rate is 2.3%";
|
||||
expect(Kiwi.compose(input, ["rate"])).toEqual(result);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue