-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert "Add visitor support (#970)""
This reverts commit 373774d.
- Loading branch information
Showing
3 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* @type {import('../runtime-config.js').RuntimeConfigListener} | ||
*/ | ||
export default { | ||
key: 'visitor', | ||
callback: value => { | ||
ANSWERS.setVisitor(value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import AnswersExperience from '../../../static/js/answers-experience'; | ||
import RuntimeConfig from '../../../static/js/runtime-config'; | ||
|
||
describe('AnswersExperience works properly', () => { | ||
it('visitor listener is called when visitor is set', () => { | ||
const runtimeConfig = new RuntimeConfig(); | ||
const experience = new AnswersExperience(runtimeConfig); | ||
const callListenerSpy = jest.spyOn(experience.runtimeConfig, '_callKeySpecificListeners'); | ||
experience.runtimeConfig.set('visitor', { id: '123', idMethod: 'test' }); | ||
expect(callListenerSpy).toHaveBeenCalledWith('update', 'visitor'); | ||
}); | ||
}); |