addEventListener doesn't reflect cmpApi.uiVisible being toggled
See original GitHub issueVersion Which version does this occur on?
1.0.0-beta.18
Module Is it core, cmpapi, cli, stub, or testing?
cmpapi
Describe the bug A clear description of what the bug is.
After receiving the ‘tcloaded’ event I am toggling cmpApi.uiVisible with a custom command:
{ showUI: (callback) => { cmpApi.uiVisible = true; } }
Nothing is received from the addEventListener callback after this happens.
Steps to Reproduce Steps to reproduce the behavior:
Load the stub, then the cmpapi. Fire an addEventListener command and then set the tcString field of the cmpapi. You will see the ‘tcloaded’ is fired. Finally, toggle a cmpApi.uiVisible = true. Notice that no event is fired.
Expected behavior A clear description of what you expected to happen.
An event should be fired whenever cmpApi.uiVisible is toggled.
Actual behavior A clear description of what happened that was not expected.
No event was fired when cmpApi.uiVisible is fired.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
@michael-sharethis setting uiVisible should not trigger an event. Only when the tcModel (or tcString) is set on the CmpApi does the event trigger.
I’m aware of this issue and have a fix for it
@chrispaterson a few more things on this (i’ve upgraded to beta.19):
after creating a cmpApi instance i’ll set its tcString and toggle uiVisible to true. the ‘tcloaded’ event will get called and not the ‘cmpuishown’ event. is this the desired behavior on your end?
once i update
cmpApi.tcString
and setcmpApi.uiVisible = false
, the ‘useractioncomplete’ event is fired. this is the right behavior. however, once i updatecmpApi.tcString
and setcmpApi.uiVisible = true
, the ‘useractioncomplete’ event is fired again… shouldn’t the ‘cmpuishown’ event be fired there instead?