Skip to content

Commit

Permalink
Make sure a proper context applied before DOM helper
Browse files Browse the repository at this point in the history
  • Loading branch information
ro0gr committed Nov 16, 2019
1 parent 124a23d commit 3947a21
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion addon-test-support/-private/dsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import { isVisible } from '../properties/is-visible';
import { text } from '../properties/text';
import { value } from '../properties/value';
import { getRoot } from './helpers';
import { chainable } from './run';

const thenDescriptor = {
isDescriptor: true,
get() {
return function() {
// this is a chainable node instance
const { _promise } = getRoot(this).__execution_context__;
const { _promise } = getRoot(chainable(this)).__execution_context__;

return _promise.then(...arguments);
}
Expand Down
7 changes: 2 additions & 5 deletions addon-test-support/-private/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,10 @@ export default function run(node, cb) {
const _cb = cb.bind(chainedNode);

let executionContext;
const chainedRoot = getRoot(chainedNode);
if (isChainedNode(node)) {
executionContext = getRoot(node).__execution_context__;
if (!executionContext) {
executionContext = getRoot(node).__execution_context__ = getExecutionContext(node);
}
executionContext = chainedRoot.__execution_context__;
} else {
const chainedRoot = getRoot(chainedNode);
executionContext = chainedRoot.__execution_context__ = getExecutionContext(chainedNode);
}

Expand Down
2 changes: 2 additions & 0 deletions addon-test-support/extend/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export default function action(fn) {

context.key = `${key}(${formattedArgs})`;

getRoot(this).__execution_context__ = context;

return fn.bind(this)(...args);
});
}
Expand Down

0 comments on commit 3947a21

Please sign in to comment.