This repository has been archived by the owner on May 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Modifiers } from '../src/Modifiers'; | ||
import { Modifier } from '../src/Modifier'; | ||
import { expect } from 'chai'; | ||
|
||
function id<T>(x: T): T { | ||
return x; | ||
} | ||
describe('core', () => { | ||
describe('Modifiers', () => { | ||
describe('prepend()', () => { | ||
it('should prepend multiples modifier in proper order', () => { | ||
const modifiers = new Modifiers(); | ||
const m1 = new Modifier(); | ||
const m2 = new Modifier(); | ||
const m3 = new Modifier(); | ||
const m4 = new Modifier(); | ||
modifiers.prepend(m1, m2, m3, m4); | ||
const modifiersMap = modifiers.map(id); | ||
expect(modifiersMap[0]).to.equal(m1); | ||
expect(modifiersMap[1]).to.equal(m2); | ||
expect(modifiersMap[2]).to.equal(m3); | ||
expect(modifiersMap[3]).to.equal(m4); | ||
}); | ||
}); | ||
describe('replaceOrAppend()', () => { | ||
it('', () => { | ||
class Modifier1 extends Modifier {} | ||
class Modifier2 extends Modifier {} | ||
const m1a = new Modifier1(); | ||
const m1b = new Modifier1(); | ||
const m2 = new Modifier2(); | ||
const modifiers1 = new Modifiers(m1a, m2); | ||
modifiers1.replaceOrAppend(new Modifiers(m1b)); | ||
const allModifiers = modifiers1.getContent(); | ||
expect(allModifiers.length).to.eql(2); | ||
expect(allModifiers[0]).to.eql(m1b); | ||
expect(allModifiers[1]).to.eql(m2); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { LinkFormat } from '../src/LinkFormat'; | ||
import { expect } from 'chai'; | ||
describe('Link', () => { | ||
describe('LinkFormat', () => { | ||
describe('clone()', () => { | ||
it('should clone the link with proper url', () => { | ||
const format = new LinkFormat('/url'); | ||
expect(format.clone().url).to.eql('/url'); | ||
}); | ||
}); | ||
}); | ||
}); |