fix(web): patches up existing unit-tests

This commit is contained in:
Joshua A. Horton 2023-08-30 10:18:26 +07:00
parent 504eb53565
commit 3aee911ea7
4 changed files with 27 additions and 27 deletions

View file

@ -5,7 +5,7 @@ import { GestureSource, InputSample } from '@keymanapp/gesture-recognizer';
describe("GestureSource", function() {
describe(".constructSubview", function() {
it("properly propagates updates", () => {
let source = new GestureSource<string>(0, true);
let source = new GestureSource<string>(0, null, true);
let subview = source.constructSubview(true, true);
assert.equal(subview.path.coords.length, 0);
@ -20,11 +20,11 @@ describe("GestureSource", function() {
source.update(sample);
assert.equal(subview.path.coords.length, 1);
assert.equal(subview.currentSample, sample);
assert.deepEqual(subview.currentSample, sample);
});
it("propagates path termination (complete)", () => {
let source = new GestureSource<string>(0, true);
let source = new GestureSource<string>(0, null, true);
let subview = source.constructSubview(true, true);
let subview2 = source.constructSubview(true, true);
@ -41,7 +41,7 @@ describe("GestureSource", function() {
subview.terminate(false);
assert.equal(subview.path.coords.length, 1);
assert.equal(subview.currentSample, sample);
assert.deepEqual(subview.currentSample, sample);
assert.equal(subview.isPathComplete, true);
assert.equal(subview.path.wasCancelled, false);
assert.equal(subview2.isPathComplete, true);

View file

@ -870,7 +870,7 @@ describe("GestureMatcher", function() {
sources[0].path.on('invalidated', () => secondMatcher.update());
timedPromise(50).then(() => {
const secondContact = new GestureSource<string>(5, true);
const secondContact = new GestureSource<string>(5, null, true);
sources.push(secondContact);
secondMatcher.addContact(secondContact);
secondContact.update({

View file

@ -67,7 +67,7 @@ describe("PathMatcher", function() {
describe("Instant fulfillment modeling", function() {
it("resolve", async function() {
const emulatedContactPoint = new GestureSource<string>(1, true);
const emulatedContactPoint = new GestureSource<string>(1, null, true);
const modelMatcher = new gestures.matchers.PathMatcher(InstantResolutionModel, emulatedContactPoint);
const startSample = {
@ -86,7 +86,7 @@ describe("PathMatcher", function() {
});
it("reject", async function() {
const emulatedContactPoint = new GestureSource<string>(1, true);
const emulatedContactPoint = new GestureSource<string>(1, null, true);
const modelMatcher = new gestures.matchers.PathMatcher(InstantRejectionModel, emulatedContactPoint);
const startSample = {
@ -107,7 +107,7 @@ describe("PathMatcher", function() {
describe("Longpress: primary path modeling", function() {
it("resolve: path completed (long wait)", async function() {
const emulatedContactPoint = new GestureSource<string>(1, true);
const emulatedContactPoint = new GestureSource<string>(1, null, true);
const modelMatcher = new gestures.matchers.PathMatcher(MainLongpressSourceModel, emulatedContactPoint);
const startSample = {
@ -133,7 +133,7 @@ describe("PathMatcher", function() {
});
it("resolve: path not completed (long wait)", async function() {
const emulatedContactPoint = new GestureSource<string>(1, true);
const emulatedContactPoint = new GestureSource<string>(1, null, true);
const modelMatcher = new gestures.matchers.PathMatcher(MainLongpressSourceModel, emulatedContactPoint);
const startSample = {
@ -159,7 +159,7 @@ describe("PathMatcher", function() {
});
it("reject: path completed (short wait)", async function() {
const emulatedContactPoint = new GestureSource<string>(1, true);
const emulatedContactPoint = new GestureSource<string>(1, null, true);
const modelMatcher = new gestures.matchers.PathMatcher(MainLongpressSourceModel, emulatedContactPoint);
const startSample = {
@ -185,7 +185,7 @@ describe("PathMatcher", function() {
});
it("reject: path cancelled", async function() {
const emulatedContactPoint = new GestureSource<string>(1, true);
const emulatedContactPoint = new GestureSource<string>(1, null, true);
const modelMatcher = new gestures.matchers.PathMatcher(MainLongpressSourceModel, emulatedContactPoint);
const startSample = {
@ -218,7 +218,7 @@ describe("PathMatcher", function() {
});
it("reject: distance moved", async function() {
const emulatedContactPoint = new GestureSource<string>(1, true);
const emulatedContactPoint = new GestureSource<string>(1, null, true);
const modelMatcher = new gestures.matchers.PathMatcher(MainLongpressSourceModel, emulatedContactPoint);
const startSample = {
@ -253,7 +253,7 @@ describe("PathMatcher", function() {
});
it("reject: item changed", async function() {
const emulatedContactPoint = new GestureSource<string>(1, true);
const emulatedContactPoint = new GestureSource<string>(1, null, true);
const modelMatcher = new gestures.matchers.PathMatcher(MainLongpressSourceModel, emulatedContactPoint);
const startSample = {
@ -287,7 +287,7 @@ describe("PathMatcher", function() {
});
it("reject: disabled up-flick shortcut", async function() {
const emulatedContactPoint = new GestureSource<string>(1, true);
const emulatedContactPoint = new GestureSource<string>(1, null, true);
const modelMatcher = new gestures.matchers.PathMatcher(MainLongpressSourceModel, emulatedContactPoint);
const startSample = {
@ -313,7 +313,7 @@ describe("PathMatcher", function() {
});
it("resolve: enabled up-flick shortcut", async function() {
const emulatedContactPoint = new GestureSource<string>(1, true);
const emulatedContactPoint = new GestureSource<string>(1, null, true);
const modelMatcher = new gestures.matchers.PathMatcher(MainLongpressSourceModelWithShortcut, emulatedContactPoint);
const startSample = {
@ -341,7 +341,7 @@ describe("PathMatcher", function() {
describe("Modipress: primary path modeling", function () {
it("push: on path start", async function() {
const emulatedContactPoint = new GestureSource<string>(1, true);
const emulatedContactPoint = new GestureSource<string>(1, null, true);
const modelMatcher = new gestures.matchers.PathMatcher(ModipressStartModel, emulatedContactPoint);
const startSample = {
@ -360,7 +360,7 @@ describe("PathMatcher", function() {
});
it("pop: released", async function() {
const emulatedContactPoint = new GestureSource<string>(1, true);
const emulatedContactPoint = new GestureSource<string>(1, null, true);
const modelMatcher = new gestures.matchers.PathMatcher(ModipressEndModel, emulatedContactPoint);
const startSample = {
@ -379,7 +379,7 @@ describe("PathMatcher", function() {
});
it("pop: item changed", async function() {
const emulatedContactPoint = new GestureSource<string>(1, true);
const emulatedContactPoint = new GestureSource<string>(1, null, true);
const modelMatcher = new gestures.matchers.PathMatcher(ModipressEndModel, emulatedContactPoint);
const startSample = {
@ -407,7 +407,7 @@ describe("PathMatcher", function() {
describe("Simple Tap: primary path modeling", function() {
it("resolve: path completed (long wait)", async function() {
const emulatedContactPoint = new GestureSource<string>(1, true);
const emulatedContactPoint = new GestureSource<string>(1, null, true);
const modelMatcher = new gestures.matchers.PathMatcher(SimpleTapModel, emulatedContactPoint);
const startSample = {
@ -433,7 +433,7 @@ describe("PathMatcher", function() {
});
it("resolve: path completed (short wait)", async function() {
const emulatedContactPoint = new GestureSource<string>(1, true);
const emulatedContactPoint = new GestureSource<string>(1, null, true);
const modelMatcher = new gestures.matchers.PathMatcher(SimpleTapModel, emulatedContactPoint);
const startSample = {
@ -459,7 +459,7 @@ describe("PathMatcher", function() {
});
it("reject: path cancelled", async function() {
const emulatedContactPoint = new GestureSource<string>(1, true);
const emulatedContactPoint = new GestureSource<string>(1, null, true);
const modelMatcher = new gestures.matchers.PathMatcher(SimpleTapModel, emulatedContactPoint);
const startSample = {
@ -492,7 +492,7 @@ describe("PathMatcher", function() {
});
it("resolve: significant movement, but no item change", async function() {
const emulatedContactPoint = new GestureSource<string>(1, true);
const emulatedContactPoint = new GestureSource<string>(1, null, true);
const modelMatcher = new gestures.matchers.PathMatcher(SimpleTapModel, emulatedContactPoint);
const startSample = {
@ -527,7 +527,7 @@ describe("PathMatcher", function() {
});
it("reject: little movement, but item changed", async function() {
const emulatedContactPoint = new GestureSource<string>(1, true);
const emulatedContactPoint = new GestureSource<string>(1, null, true);
const modelMatcher = new gestures.matchers.PathMatcher(SimpleTapModel, emulatedContactPoint);
const startSample = {

View file

@ -33,7 +33,7 @@ interface MockedPredecessor<Type> {
sample: InputSample<Type>,
baseItem: Type
},
sources: GestureSource<Type>[],
sources: GestureSource<Type>[], // FIX ME.
_result: {
action: {
item: Type
@ -45,7 +45,7 @@ function mockedPredecessor<Type>(
lastSample: InputSample<Type>,
baseItem?: Type
): MockedPredecessor<Type> {
const mockedSrc = new GestureSource<Type>(simSourceIdSeed++, true);
const mockedSrc = new GestureSource<Type>(simSourceIdSeed++, null, true);
mockedSrc.path.extend(lastSample);
mockedSrc.terminate(false);
@ -97,7 +97,7 @@ function prepareSourceForTimer<Type> (
timerSpec: SimSpecTimer<Type>,
startTime: number
): ReturnType<typeof prepareSimContact<Type>> {
const simpleSource = new GestureSource<Type>(simSourceIdSeed++, true);
const simpleSource = new GestureSource<Type>(simSourceIdSeed++, null, true);
const promise = timedPromise(startTime).then(() => {
// We're simulating a previously-completed contact point's path..
@ -124,7 +124,7 @@ function prepareSourceForRawSequence<Type>(
contactSpec: SimSpecSequence<Type>,
startTime: number
): ReturnType<typeof prepareSimContact<Type>> {
const simpleSource = new GestureSource<Type>(simSourceIdSeed++, true);
const simpleSource = new GestureSource<Type>(simSourceIdSeed++, null, true);
const promise = timedPromise(startTime).then(() => {
if(startTime != 0) {