Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V4: New component-object, new test APIs, tests to b-virtual-scroll-new #896

Merged
merged 176 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
176 commits
Select commit Hold shift + click to select a range
d172f8d
Working on b-scrolly
bonkalol Jan 20, 2023
2eda52d
Initial commit
bonkalol Mar 22, 2023
4e9ccd8
WIP b-scrolly
bonkalol Apr 7, 2023
33bef46
Merge branch 'v4' of https://github.com/v4fire/client into b-scrolly
bonkalol Apr 7, 2023
10ab99d
WIP
bonkalol Apr 20, 2023
fc83e1d
Merge branch 'v4' of https://github.com/v4fire/client into b-scrolly
bonkalol Apr 20, 2023
a2b3334
WIP
bonkalol Jun 1, 2023
bfc4fb1
WIP
bonkalol Jun 7, 2023
b23f469
WIP
bonkalol Jun 7, 2023
44bf468
WIP
bonkalol Jun 9, 2023
c6d88af
WIP
bonkalol Jun 11, 2023
705ae8f
:art:
bonkalol Jun 11, 2023
070bb19
WIP
bonkalol Jun 11, 2023
f529c2b
WIP
bonkalol Jun 11, 2023
2ba63f9
:art:
bonkalol Jun 11, 2023
03bb5c1
Rework rendering convoyer
bonkalol Jun 12, 2023
3c8587b
Rework rendering convoyer
bonkalol Jun 12, 2023
4304851
:art: itemsFactory
bonkalol Jun 12, 2023
822e697
WIP
bonkalol Jun 12, 2023
7a0ebaa
WIP
bonkalol Jun 12, 2023
77944ef
Documentation improvements
bonkalol Jun 14, 2023
bf019a8
:art:
bonkalol Jun 14, 2023
21ee4a3
WIP
bonkalol Jun 15, 2023
a1e6266
:art:
bonkalol Jun 15, 2023
361c382
:art: docs
bonkalol Jun 16, 2023
d66909d
WIP
bonkalol Jun 16, 2023
8550183
:art:
bonkalol Jun 16, 2023
49679fc
:art:
bonkalol Jun 16, 2023
9f7099e
Merge v4
bonkalol Jun 16, 2023
6db51ae
:art:
bonkalol Jun 16, 2023
a34263e
WIP
bonkalol Jun 16, 2023
169ce84
WIP
bonkalol Jun 19, 2023
8d47025
WIP
bonkalol Jun 20, 2023
1dab519
WIP
bonkalol Jun 20, 2023
540e9af
:art:
bonkalol Jun 20, 2023
0886904
WIP
bonkalol Jun 21, 2023
bf9a4ad
WIP
bonkalol Jun 22, 2023
fb4d522
WIP
bonkalol Jun 23, 2023
916ce09
WIP
bonkalol Jun 25, 2023
3fdacff
WIP
bonkalol Jun 25, 2023
05ac277
WIP
bonkalol Jun 25, 2023
c828a49
:art:
bonkalol Jun 25, 2023
07796fa
Add test cases for retry
bonkalol Jun 27, 2023
13fa1e3
Test cases for manual rendering
bonkalol Jun 27, 2023
43128e4
:art:
bonkalol Jun 27, 2023
4de7783
:art:
bonkalol Jun 27, 2023
ea2bdfa
onRequestError support
bonkalol Jun 28, 2023
e23a8ae
Immediate transition to the loading state
bonkalol Jun 28, 2023
881460c
Test cases for set
bonkalol Jun 28, 2023
103c971
Remove b-virtual-scroll legacy
bonkalol Jun 28, 2023
b0dff92
renamed b-scrolly into b-virtual-scroll
bonkalol Jun 28, 2023
524266a
:wrench:
bonkalol Jul 4, 2023
3b0f5fe
:wrench:
bonkalol Jul 4, 2023
fc5e7b5
Refactoring
bonkalol Jul 4, 2023
593065e
Upd readme
bonkalol Jul 5, 2023
fce6999
:wrench:
bonkalol Jul 7, 2023
d7c6edf
WIP
bonkalol Jul 8, 2023
8e27ca8
WIP docs
bonkalol Jul 9, 2023
9fd65f3
:art:
bonkalol Jul 9, 2023
fd40c7e
:art:
bonkalol Jul 9, 2023
3852620
:wrench:
bonkalol Jul 10, 2023
0e5b326
:wrench:
bonkalol Jul 10, 2023
e99d388
:wrench:
bonkalol Jul 10, 2023
a8d0de5
Remove redundant props
bonkalol Jul 10, 2023
2216700
:wrench:
bonkalol Jul 10, 2023
15fefca
:art: docs
bonkalol Jul 10, 2023
30d21e3
Merge branch 'v4' of https://github.com/v4fire/client into b-scrolly
bonkalol Jul 10, 2023
154f0fb
:wrench:
bonkalol Jul 10, 2023
ab44744
:wrench:
bonkalol Jul 10, 2023
04cf61b
:art:
bonkalol Jul 10, 2023
90afea4
:art:
bonkalol Jul 10, 2023
69b1011
:art:
bonkalol Jul 10, 2023
a104b8f
:art:
bonkalol Jul 10, 2023
1bf8d07
:art:
bonkalol Jul 10, 2023
706dad0
:art:
bonkalol Jul 10, 2023
a1569df
:wrench:
bonkalol Jul 12, 2023
c535d49
Fixed an issue with possible chunk inserting cancelation
bonkalol Jul 12, 2023
4dcfd4d
Fixed an issue with tillEnd fields was not updated after data loading
bonkalol Jul 12, 2023
7ba35df
:art: review
bonkalol Jul 24, 2023
392778e
Merge branch 'v4' of https://github.com/v4fire/client into b-scrolly
bonkalol Jul 24, 2023
e60237a
:art: review
bonkalol Jul 28, 2023
98f4cc5
:art: review
bonkalol Jul 28, 2023
7f8213a
:art: review
bonkalol Jul 28, 2023
46e1c54
:art:
bonkalol Jul 28, 2023
6933bdb
docs
bonkalol Jul 30, 2023
27fe394
:art:
bonkalol Jul 31, 2023
6c56337
Merge branch 'b-scrolly' of https://github.com/v4fire/client into b-s…
bonkalol Aug 23, 2023
1af0351
Added component processors
bonkalol Aug 23, 2023
fde71a2
Drop dead code
bonkalol Aug 23, 2023
607ccff
Added new features
bonkalol Aug 31, 2023
7ead1a4
wip docs
bonkalol Sep 1, 2023
3e92375
WIP
bonkalol Sep 3, 2023
7ea8669
WIP
bonkalol Sep 3, 2023
fc37989
:art:
bonkalol Sep 3, 2023
9575b1c
:art:
bonkalol Sep 4, 2023
dd27f88
Add doctoc
bonkalol Sep 4, 2023
5a684a3
:art:
bonkalol Sep 4, 2023
46d1c6a
:art:
bonkalol Sep 4, 2023
bca9e62
WIP
bonkalol Sep 5, 2023
0574cd7
:wrench:
bonkalol Sep 7, 2023
38bfe09
:art:
bonkalol Sep 7, 2023
47225d8
:art:
bonkalol Sep 7, 2023
510f505
:art:
bonkalol Sep 7, 2023
434fedf
Merge branch 'v4' of https://github.com/v4fire/client into b-scrolly
bonkalol Sep 7, 2023
8bab5fc
Added toc
bonkalol Sep 7, 2023
e2c41b1
:art:
bonkalol Sep 7, 2023
78b3a8c
:wrench:
bonkalol Sep 8, 2023
0490e71
:art:
bonkalol Sep 11, 2023
f0ef53e
:art:
bonkalol Sep 11, 2023
d1f37f4
:art:
bonkalol Sep 11, 2023
28961ce
Merge branch 'v4' of https://github.com/v4fire/client into b-scrolly
bonkalol Sep 12, 2023
0a6f429
:wrench:
bonkalol Sep 12, 2023
656daa3
Merge branch 'v4' of https://github.com/v4fire/client into b-scrolly
bonkalol Oct 2, 2023
82dd4a3
Fix linter
bonkalol Oct 2, 2023
ff7cce6
:wrench: refac component object
bonkalol Oct 5, 2023
4a335df
:art:
bonkalol Oct 5, 2023
02e2c3c
chore: reformat table
kobezzza Oct 13, 2023
e40811c
:art:
bonkalol Oct 18, 2023
c76f3e8
Merge branch 'b-scrolly' of https://github.com/v4fire/client into b-s…
bonkalol Oct 18, 2023
78bfd62
Added functional optional for componentObject.build
bonkalol Oct 18, 2023
2861c06
Improved the ResponseOptions interface of the RequestInterceptor modu…
bonkalol Oct 19, 2023
3ffba2a
:art:
bonkalol Oct 19, 2023
fed2eba
Added short-hand for RequestInterceptor.prototype.mock.mock.calls
bonkalol Oct 21, 2023
47ac9d6
Added request function for RequestInterceptor
bonkalol Oct 23, 2023
e1072b7
Fixed an issue with wrong inheratance chain in tests/config/project f…
bonkalol Oct 23, 2023
676007e
Fix type of InterceptedRequest.query
bonkalol Oct 24, 2023
9acecdf
Merge branch 'v4' of https://github.com/v4fire/client into b-scrolly
bonkalol Oct 24, 2023
ec2b735
Added a "responder" mode for RequestInterceptor
bonkalol Oct 25, 2023
7f2f797
:wrench:
bonkalol Nov 2, 2023
14e7852
:wrench:
bonkalol Nov 9, 2023
0b6e43d
:art: test-api
bonkalol Nov 11, 2023
4d29714
Added activate and deactivate methods to the componentObject
bonkalol Nov 13, 2023
f5383cb
Merge branch 'v4' of https://github.com/v4fire/client into b-scrolly
bonkalol Nov 16, 2023
563b88f
:art:
bonkalol Nov 21, 2023
ccd1d38
:wrench:
bonkalol Nov 21, 2023
70e9413
Fixed an issue with wrong itemIndex calculation; Provide a context to…
bonkalol Dec 22, 2023
a59d13a
Исправил проблему с учетом data-testid в методе pick, теперь вместо э…
bonkalol Dec 25, 2023
a514609
Added isLastRender for b-virtual-scroll state, added getItemsProcesso…
bonkalol Dec 31, 2023
e58e383
:art:
bonkalol Jan 8, 2024
b1e3b11
Merge branch 'b-scrolly' of https://github.com/v4fire/client into b-s…
bonkalol Jan 8, 2024
e70e19c
:art:
bonkalol Jan 8, 2024
6bec875
:art:
bonkalol Jan 8, 2024
124367c
Merge branch 'v4' of https://github.com/v4fire/client into b-scrolly
bonkalol Jan 8, 2024
7c98689
Remove wrong code
bonkalol Jan 8, 2024
a7cae66
Update yarn.lock
bonkalol Jan 8, 2024
3a9dc9b
Fixed an issue with providing child elements in createComponentViaDummy
bonkalol Jan 15, 2024
4938eac
Added items prop to b-virtual-scroll
bonkalol Jan 24, 2024
f39717c
:art:
bonkalol Jan 25, 2024
9743031
:art:
bonkalol Jan 25, 2024
7f7c8ec
:art:
bonkalol Jan 25, 2024
5804c6a
:art:
bonkalol Jan 25, 2024
40b4729
Improve isLastRender and lastRender behavior, now performing the last…
bonkalol Jan 29, 2024
7dc2fdf
Added one more test for retry slot
bonkalol Jan 29, 2024
0c3f1fc
:art: readme
bonkalol Jan 29, 2024
5cc81c8
:art: readme
bonkalol Jan 29, 2024
83475d1
remove noData reason of renderGuardRejectionReason because its no mor…
bonkalol Jan 29, 2024
184037f
:art:
bonkalol Jan 30, 2024
d965334
Merge branch 'v4' of https://github.com/v4fire/client into b-scrolly
bonkalol Feb 7, 2024
47d7162
Update branch, chagned b-virtual-scroll -> b-virtual-scroll-new
bonkalol Feb 7, 2024
36abd31
:art:
bonkalol Feb 7, 2024
8c81cb7
Rollback bad code removing
bonkalol Feb 7, 2024
efcb919
Rollback bad code removing
bonkalol Feb 7, 2024
627f6be
Removed useless jest-mock dep
bonkalol Feb 7, 2024
1916847
Added aliases for node modules into webpack to prevent node modules i…
bonkalol Feb 7, 2024
a1f8b0f
Added one more alias for jest
bonkalol Feb 7, 2024
57b1e51
Fixed an issue where lifecycleDone could be emitted before the last r…
bonkalol Feb 7, 2024
97eeca5
:wrecnh:
bonkalol Feb 7, 2024
32427d4
:wrench:
bonkalol Feb 7, 2024
58cfc75
:art:
bonkalol Feb 8, 2024
0d404c2
:art: review
bonkalol Feb 9, 2024
265abba
:art:
bonkalol Feb 9, 2024
e18c396
Merge branch 'v4' of https://github.com/v4fire/client into b-scrolly
bonkalol Feb 9, 2024
e535547
:art:
bonkalol Feb 9, 2024
37a43e7
rollback i-data change
bonkalol Feb 9, 2024
ec1701d
:art:
bonkalol Feb 9, 2024
b529da9
Merge branch 'b-scrolly' of https://github.com/v4fire/client into b-s…
bonkalol Feb 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ Changelog

_Note: Gaps between patch versions are faulty, broken or test releases._

## v4.0.0-beta.56 (2024-02-09)

#### :rocket: New Feature

* New test APIs:
* Request interceptor `tests/helpers/network/interceptor`;
* ComponentObject `tests/helpers/component-object`;
* Spy and mock `tests/helpers/mock`;
* Component.createComponentInDummy `tests/helpers/component`.

#### :bug: Bug Fix

* Fixed the problem that the `lifecycleDone` event could fire before `renderDone` `components/base/b-virtual-scroll-new`

#### :house: Internal

* Added tests for `b-virtual-scroll-new` `components/base/b-virtual-scroll-new`

## v4.0.0-beta.55 (2024-02-08)

#### :boom: Breaking Change
Expand Down
8 changes: 8 additions & 0 deletions build/webpack/resolve/alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ const
*/
const aliases = {
'@super': resolve.rootDependencies[0],

// This is required for using jest-mock,
// otherwise jest-mock pulls various Node.js modules into the browser environment.
'graceful-fs': false,
path: false,
picomatch: false,
url: false,

...$C(pzlr.dependencies).to({}).reduce((map, el, i) => {
const
asset = resolve.depMap[el].config.assets;
Expand Down
8 changes: 5 additions & 3 deletions components-lock.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"hash": "865280bfec97ef8005ed118094d96b33afcfece456c2a8b26c419ca2093656e6",
"hash": "098211bcc31aa8c403e2f0f126046ef09ad2fb212477edeb5a60735ae3e661f0",
"data": {
"%data": "%data:Map",
"%data:Map": [
Expand Down Expand Up @@ -2261,8 +2261,9 @@
"b-remote-provider",
"b-list",
"b-tree",
"b-virtual-scroll",
"b-window",
"b-virtual-scroll",
"b-virtual-scroll-new",
"b-bottom-slide",
"b-slider",
"b-sidebar",
Expand Down Expand Up @@ -2303,8 +2304,9 @@
"b-remote-provider",
"b-list",
"b-tree",
"b-virtual-scroll",
"b-window",
"b-virtual-scroll",
"b-virtual-scroll-new",
"b-bottom-slide",
"b-slider",
"b-sidebar",
Expand Down
27 changes: 26 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,32 @@ declare var
* Requires a module by the specified path.
* This function should only be used when writing tests.
*/
importModule: (path: string) => any;
importModule: (path: string) => any,

/**
* Jest mock API for test environment.
*/
jestMock: {
/**
* Wrapper for jest `spyOn` function.
* @see https://jestjs.io/docs/mock-functions
*/
spy: import('jest-mock').ModuleMocker['spyOn'];

/**
* Wrapper for jest `fn` function.
* @see https://jestjs.io/docs/mock-functions
*/
mock: import('jest-mock').ModuleMocker['fn'];
};

/**
* The results returned by a mock or spy function from `jestMock`.
*/
interface JestMockResult<VAL = any> {
type: 'throw' | 'return';
value: VAL;
}

interface TouchGesturesCreateOptions {
/**
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"cssnano": "5.0.17",
"del": "6.0.0",
"delay": "5.0.0",
"doctoc": "2.2.1",
"extract-loader": "5.1.0",
"fast-glob": "3.2.12",
"favicons": "7.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,11 @@ export default class bVirtualScrollNew extends iVirtualScrollHandlers implements
});
});

this.componentInternalState.setIsDomInsertInProgress(true);

this.async.requestAnimationFrame(() => {
this.$refs.container.appendChild(fragment);
this.componentInternalState.setIsDomInsertInProgress(false);

this.onDomInsertDone();
this.onRenderDone();
Expand Down
10 changes: 10 additions & 0 deletions src/components/base/b-virtual-scroll-new/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,16 @@ export const componentEvents = <const>{
...componentObserverLocalEvents
};

/**
* Internal component events (emitted in localEmitter)
*/
export const componentLocalEvents = <const>{
/**
* The rendering cycle of components has completed (the path from renderStart to renderDone has been traversed)
*/
renderCycleDone: 'renderCycleDone'
};

/**
* Reasons for rejecting a render operation.
*/
Expand Down
29 changes: 24 additions & 5 deletions src/components/base/b-virtual-scroll-new/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@
* https://github.com/V4Fire/Client/blob/master/LICENSE
*/

import symbolGenerator from 'core/symbol';

import iVirtualScrollProps from 'components/base/b-virtual-scroll-new/props';

import type bVirtualScrollNew from 'components/base/b-virtual-scroll-new/b-virtual-scroll-new';
import type { MountedChild } from 'components/base/b-virtual-scroll-new/interface';

import { bVirtualScrollNewAsyncGroup, componentEvents } from 'components/base/b-virtual-scroll-new/const';
import { bVirtualScrollNewAsyncGroup, componentEvents, componentLocalEvents } from 'components/base/b-virtual-scroll-new/const';
import { isAsyncReplaceError } from 'components/base/b-virtual-scroll-new/modules/helpers';

import iData, { component } from 'components/super/i-data/i-data';

const $$ = symbolGenerator();

/**
* A class that provides an API to handle events emitted by the {@link bVirtualScrollNew} component.
* This class is designed to work in conjunction with {@link bVirtualScrollNew}.
Expand Down Expand Up @@ -89,6 +93,7 @@ export abstract class iVirtualScrollHandlers extends iVirtualScrollProps {
*/
protected onRenderDone(this: bVirtualScrollNew): void {
this.componentEmitter.emit(componentEvents.renderDone);
this.localEmitter.emit(componentLocalEvents.renderCycleDone);
}

/**
Expand All @@ -97,15 +102,29 @@ export abstract class iVirtualScrollHandlers extends iVirtualScrollProps {
*/
protected onLifecycleDone(this: bVirtualScrollNew): void {
const
state = this.getVirtualScrollState();
state = this.getVirtualScrollState(),
isDomInsertInProgress = this.componentInternalState.getIsDomInsertInProgress();

if (state.isLifecycleDone) {
return;
}

this.slotsStateController.doneState();
this.componentInternalState.setIsLifecycleDone(true);
this.componentEmitter.emit(componentEvents.lifecycleDone);
const handler = () => {
this.slotsStateController.doneState();
this.componentInternalState.setIsLifecycleDone(true);
this.componentEmitter.emit(componentEvents.lifecycleDone);
};

if (isDomInsertInProgress) {
this.localEmitter.once(componentLocalEvents.renderCycleDone, handler, {
group: bVirtualScrollNewAsyncGroup,
label: $$.waitUntilRenderDone
});

return;
}

return handler();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ export interface PrivateComponentState {
* Pointer to the index of the data element that was last rendered.
*/
dataOffset: number;

/**
* If true, it means that the process of inserting components into the DOM tree is currently in progress.
*/
isDomInsertInProgress: boolean;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export function createInitialState(): VirtualScrollState {
*/
export function createPrivateInitialState(): PrivateComponentState {
return {
dataOffset: 0
dataOffset: 0,
isDomInsertInProgress: false
};
}
16 changes: 16 additions & 0 deletions src/components/base/b-virtual-scroll-new/modules/state/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ export class ComponentInternalState extends Friend {
this.state.isInitialRender = value;
}

/**
* Sets the flag indicating that the process of inserting components into the DOM tree is currently in progress
* @param value
*/
setIsDomInsertInProgress(value: boolean): void {
this.privateState.isDomInsertInProgress = value;
}

/**
* Sets the flag indicating if requests are stopped and the component won't make any more requests
* until the lifecycle is refreshed.
Expand Down Expand Up @@ -190,6 +198,14 @@ export class ComponentInternalState extends Friend {
return this.privateState.dataOffset;
}

/**
* Returns the value of the flag indicating whether the process
* of inserting components into the DOM tree is currently in progress
*/
getIsDomInsertInProgress(): boolean {
return this.privateState.isDomInsertInProgress;
}

/**
* Updates the cursor indicating the last index of the last rendered data element
*/
Expand Down
Loading
Loading