@flighthq/easing 0.3.0-next.1272.222de94 → 0.3.0-next.1297.43a5ef8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flighthq/easing",
3
- "version": "0.3.0-next.1272.222de94",
3
+ "version": "0.3.0-next.1297.43a5ef8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/flighthq/flight.git",
@@ -36,7 +36,7 @@
36
36
  "clean:dist": "tsx ../../scripts/clean-package-dist.ts"
37
37
  },
38
38
  "dependencies": {
39
- "@flighthq/types": "0.3.0-next.1272.222de94"
39
+ "@flighthq/types": "0.3.0-next.1297.43a5ef8"
40
40
  },
41
41
  "devDependencies": {
42
42
  "typescript": "^5.3.0"
@@ -1,4 +1,4 @@
1
- import { easeSteps } from './easeSteps';
1
+ import { easeSteps, setEasingStepsGuard } from './easeSteps';
2
2
 
3
3
  describe('easeSteps', () => {
4
4
  it('jumpEnd holds at 0 first and reaches 1 only at t=1', () => {
@@ -63,3 +63,36 @@ describe('easeSteps', () => {
63
63
  }
64
64
  });
65
65
  });
66
+
67
+ describe('setEasingStepsGuard', () => {
68
+ it('invokes the installed guard for the degenerate jumpNone, count<2 call', () => {
69
+ const calls: unknown[] = [];
70
+ setEasingStepsGuard((count, position) => calls.push([count, position]));
71
+ try {
72
+ easeSteps(1, 'jumpNone');
73
+ expect(calls).toEqual([[1, 'jumpNone']]);
74
+ } finally {
75
+ setEasingStepsGuard(null);
76
+ }
77
+ });
78
+
79
+ it('does not invoke the guard for well-defined calls', () => {
80
+ const calls: unknown[] = [];
81
+ setEasingStepsGuard((count, position) => calls.push([count, position]));
82
+ try {
83
+ easeSteps(4, 'jumpNone');
84
+ easeSteps(1, 'jumpEnd');
85
+ expect(calls).toEqual([]);
86
+ } finally {
87
+ setEasingStepsGuard(null);
88
+ }
89
+ });
90
+
91
+ it('stops invoking a previously installed guard once set back to null', () => {
92
+ const calls: unknown[] = [];
93
+ setEasingStepsGuard((count, position) => calls.push([count, position]));
94
+ setEasingStepsGuard(null);
95
+ easeSteps(1, 'jumpNone');
96
+ expect(calls).toEqual([]);
97
+ });
98
+ });