Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-08-10 13:30:39 -0400
committerMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-08-10 13:33:54 -0400
commitb47deedf9c85b24d748a653cd4eda02245e5a0df (patch)
treea0b97f51d72950da8fd2bdb208db5d35a17506ec /test
parent9243eeb8bcc487ae375edb0910dcc592c99e3778 (diff)
downloadliza-b47deedf9c85b24d748a653cd4eda02245e5a0df.tar.gz
liza-b47deedf9c85b24d748a653cd4eda02245e5a0df.tar.bz2
liza-b47deedf9c85b24d748a653cd4eda02245e5a0df.zip
[DEV-3257] DataApiMediator: Set bucket data after stack clear
Allowing the stack to clear ensures that (in practice) DelayedStagingBucket is given a chance to do necessary processing before data are requested from it by bucket hooks as a result of _this_ invocation, which in turn results (in some cases) in infinite recursion. * src/client/dapi/DataApiMediator.js (_updateFieldData): Allow stack to clear before invoking `quote.setData'. * test/client/dapi/DataApiMediatorTest.js: Test respectively. DEV-3257
Diffstat (limited to 'test')
-rw-r--r--test/client/dapi/DataApiMediatorTest.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/client/dapi/DataApiMediatorTest.js b/test/client/dapi/DataApiMediatorTest.js
index fee5f56..62e12b1 100644
--- a/test/client/dapi/DataApiMediatorTest.js
+++ b/test/client/dapi/DataApiMediatorTest.js
@@ -319,7 +319,8 @@ describe( "DataApiMediator", () =>
{
it( label, done =>
{
- let set_options = false;
+ let set_options = false;
+ let stack_cleared = false;
const quote = {
getDataByName( given_name )
@@ -329,6 +330,9 @@ describe( "DataApiMediator", () =>
setData( given_data )
{
+ // we should have allowed the stack to clear first
+ expect( stack_cleared ).to.be.true;
+
expect( given_data ).to.deep.equal( expected );
// should have called setOptions by now
@@ -382,6 +386,11 @@ describe( "DataApiMediator", () =>
dapi_manager.emit(
'updateFieldData', name, index, val_label, results
);
+
+ // #setData should be triggered after the stack clears to
+ // #mitigate issues with hooks causing too much / infinite
+ // #recursion on the bucket on the same stack
+ stack_cleared = true;
} );
} );