aboutsummaryrefslogtreecommitdiff
path: root/test/content/usecases/KeymapUseCase.test.ts
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-12-21 17:51:48 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2019-12-21 18:42:49 +0900
commit5963b91cbdf880e1f10b77146d3be5775f0920c0 (patch)
tree15e4662e4ace516899430a98f04747dea0bef589 /test/content/usecases/KeymapUseCase.test.ts
parentd05f1ad554551919f8c603d335df578674752b06 (diff)
Rename count to repeat
Diffstat (limited to 'test/content/usecases/KeymapUseCase.test.ts')
-rw-r--r--test/content/usecases/KeymapUseCase.test.ts32
1 files changed, 16 insertions, 16 deletions
diff --git a/test/content/usecases/KeymapUseCase.test.ts b/test/content/usecases/KeymapUseCase.test.ts
index 904a180..598d5a3 100644
--- a/test/content/usecases/KeymapUseCase.test.ts
+++ b/test/content/usecases/KeymapUseCase.test.ts
@@ -72,10 +72,10 @@ describe('KeymapUseCase', () => {
});
it('returns matched operation', () => {
- expect(sut.nextOps(Key.fromMapKey('k'))).to.deep.equal({ count: 1, op: {type: 'scroll.vertically', count: -1}});
- expect(sut.nextOps(Key.fromMapKey('j'))).to.deep.equal({ count: 1, op: {type: 'scroll.vertically', count: 1}});
+ expect(sut.nextOps(Key.fromMapKey('k'))).to.deep.equal({ repeat: 1, op: {type: 'scroll.vertically', count: -1}});
+ expect(sut.nextOps(Key.fromMapKey('j'))).to.deep.equal({ repeat: 1, op: {type: 'scroll.vertically', count: 1}});
expect(sut.nextOps(Key.fromMapKey('g'))).to.be.null;
- expect(sut.nextOps(Key.fromMapKey('g'))).to.deep.equal({ count: 1, op: {type: 'scroll.top'}});
+ expect(sut.nextOps(Key.fromMapKey('g'))).to.deep.equal({ repeat: 1, op: {type: 'scroll.top'}});
expect(sut.nextOps(Key.fromMapKey('z'))).to.be.null;
});
@@ -83,7 +83,7 @@ describe('KeymapUseCase', () => {
expect(sut.nextOps(Key.fromMapKey('1'))).to.be.null;
expect(sut.nextOps(Key.fromMapKey('0'))).to.be.null;
expect(sut.nextOps(Key.fromMapKey('g'))).to.be.null;
- expect(sut.nextOps(Key.fromMapKey('g'))).to.deep.equal({ count: 10, op: {type: "scroll.top"}});
+ expect(sut.nextOps(Key.fromMapKey('g'))).to.deep.equal({ repeat: 10, op: {type: "scroll.top"}});
});
});
@@ -108,18 +108,18 @@ describe('KeymapUseCase', () => {
it('returns the matched operation ends with digit', () => {
expect(sut.nextOps(Key.fromMapKey('g'))).to.be.null;
- expect(sut.nextOps(Key.fromMapKey('5'))).to.be.deep.equal({ count: 1, op: { type: 'scroll.bottom'}});
+ expect(sut.nextOps(Key.fromMapKey('5'))).to.be.deep.equal({ repeat: 1, op: { type: 'scroll.bottom'}});
});
it('returns an operation matched the operation with digit keymaps', () => {
expect(sut.nextOps(Key.fromMapKey('2'))).to.be.null;
- expect(sut.nextOps(Key.fromMapKey('0'))).to.be.deep.equal({ count: 1, op: { type: 'scroll.top'}});
+ expect(sut.nextOps(Key.fromMapKey('0'))).to.be.deep.equal({ repeat: 1, op: { type: 'scroll.top'}});
});
it('returns operations repeated by numeric prefix', () => {
expect(sut.nextOps(Key.fromMapKey('2'))).to.be.null;
expect(sut.nextOps(Key.fromMapKey('g'))).to.be.null;
- expect(sut.nextOps(Key.fromMapKey('5'))).to.be.deep.equal({ count: 2, op: { type: 'scroll.bottom'}});
+ expect(sut.nextOps(Key.fromMapKey('5'))).to.be.deep.equal({ repeat: 2, op: { type: 'scroll.bottom'}});
});
it('does not matches with digit operation with numeric prefix', () => {
@@ -127,7 +127,7 @@ describe('KeymapUseCase', () => {
expect(sut.nextOps(Key.fromMapKey('2'))).to.be.null;
expect(sut.nextOps(Key.fromMapKey('0'))).to.be.null;
expect(sut.nextOps(Key.fromMapKey('g'))).to.be.null;
- expect(sut.nextOps(Key.fromMapKey('5'))).to.be.deep.equal({ count: 320, op: { type: 'scroll.bottom'}});
+ expect(sut.nextOps(Key.fromMapKey('5'))).to.be.deep.equal({ repeat: 320, op: { type: 'scroll.bottom'}});
});
});
@@ -154,7 +154,7 @@ describe('KeymapUseCase', () => {
expect(sut.nextOps(Key.fromMapKey('g'))).to.be.null;
expect(sut.nextOps(Key.fromMapKey('x'))).to.be.null; // clear
expect(sut.nextOps(Key.fromMapKey('g'))).to.be.null;
- expect(sut.nextOps(Key.fromMapKey('g'))).to.deep.equal({count: 1, op: {type: "scroll.top"}});
+ expect(sut.nextOps(Key.fromMapKey('g'))).to.deep.equal({repeat: 1, op: {type: "scroll.top"}});
});
it('clears input keys and the prefix with no-matched operations', () => {
@@ -165,7 +165,7 @@ describe('KeymapUseCase', () => {
expect(sut.nextOps(Key.fromMapKey('1'))).to.be.null;
expect(sut.nextOps(Key.fromMapKey('0'))).to.be.null;
expect(sut.nextOps(Key.fromMapKey('g'))).to.be.null;
- expect(sut.nextOps(Key.fromMapKey('g'))).to.deep.equal({ count: 10, op: {type: "scroll.top"}});
+ expect(sut.nextOps(Key.fromMapKey('g'))).to.deep.equal({ repeat: 10, op: {type: "scroll.top"}});
});
});
@@ -191,8 +191,8 @@ describe('KeymapUseCase', () => {
it('returns only ADDON_ENABLE and ADDON_TOGGLE_ENABLED operation', () => {
expect(sut.nextOps(Key.fromMapKey('k'))).to.be.null;
- expect(sut.nextOps(Key.fromMapKey('a'))).to.deep.equal({ count: 1, op: {type: 'addon.enable'}});
- expect(sut.nextOps(Key.fromMapKey('b'))).to.deep.equal({ count: 1, op: {type: 'addon.toggle.enabled'}});
+ expect(sut.nextOps(Key.fromMapKey('a'))).to.deep.equal({ repeat: 1, op: {type: 'addon.enable'}});
+ expect(sut.nextOps(Key.fromMapKey('b'))).to.deep.equal({ repeat: 1, op: {type: 'addon.toggle.enabled'}});
});
});
@@ -218,11 +218,11 @@ describe('KeymapUseCase', () => {
new MockAddressRepository(new URL('https://example.com')),
);
- expect(sut.nextOps(Key.fromMapKey('k'))).to.deep.equal({ count: 1, op: {type: 'scroll.vertically', count: -1}});
- expect(sut.nextOps(Key.fromMapKey('j'))).to.deep.equal({ count: 1, op: {type: 'scroll.vertically', count: 1}});
+ expect(sut.nextOps(Key.fromMapKey('k'))).to.deep.equal({ repeat: 1, op: {type: 'scroll.vertically', count: -1}});
+ expect(sut.nextOps(Key.fromMapKey('j'))).to.deep.equal({ repeat: 1, op: {type: 'scroll.vertically', count: 1}});
expect(sut.nextOps(Key.fromMapKey('g'))).to.be.null;
expect(sut.nextOps(Key.fromMapKey('g'))).to.be.null;
- expect(sut.nextOps(Key.fromMapKey('G'))).to.deep.equal({ count: 1, op: {type: 'scroll.bottom'}});
+ expect(sut.nextOps(Key.fromMapKey('G'))).to.deep.equal({ repeat: 1, op: {type: 'scroll.bottom'}});
sut = new KeymapUseCase(
new KeymapRepositoryImpl(),
@@ -232,7 +232,7 @@ describe('KeymapUseCase', () => {
);
expect(sut.nextOps(Key.fromMapKey('g'))).to.be.null;
- expect(sut.nextOps(Key.fromMapKey('g'))).to.deep.equal({ count: 1, op: {type: 'scroll.top'}});
+ expect(sut.nextOps(Key.fromMapKey('g'))).to.deep.equal({ repeat: 1, op: {type: 'scroll.top'}});
expect(sut.nextOps(Key.fromMapKey('G'))).to.be.null;
});
});