Skip to content

Commit

Permalink
fix: emit state change after load progress
Browse files Browse the repository at this point in the history
  • Loading branch information
vanilla-wave committed Aug 3, 2023
1 parent beae3e0 commit 799336b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,21 @@ describe('store api', function () {
expect(cb).not.toHaveBeenCalled();
});

it('load progress -> trigger callback', async function () {
const options = getOptions();

const controller = new Controller(options);
const cb = jest.fn();
controller.subscribe(cb);

await controller.stepElementReached({
stepSlug: 'createSprint',
element: getAnchorElement(),
});

expect(cb).toHaveBeenCalled();
});

it('change state -> trigger callback', async function () {
const options = getOptions();

Expand Down
1 change: 1 addition & 0 deletions src/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ export class Controller<HintParams, Presets extends string, Steps extends string
...newProgressState,
};
this.status = 'active';
this.emitChange();

this.logger.debug('Onboarding progress data loaded');
} catch (e) {
Expand Down

0 comments on commit 799336b

Please sign in to comment.