Skip to content

Commit

Permalink
prevent child transition events from interfering with transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
evs-chris committed Mar 8, 2019
1 parent 2eab538 commit 117273c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/view/items/element/transitions/createTransitions.js
Expand Up @@ -78,6 +78,7 @@ if (!isClient) {
};

function transitionEndHandler(event) {
if (event.target !== t.node) return;
const index = changedProperties.indexOf(event.propertyName);

if (index !== -1) {
Expand Down
38 changes: 38 additions & 0 deletions tests/browser/plugins/transitions.js
Expand Up @@ -1201,4 +1201,42 @@ export default function() {

r.render(fixture).then(() => r.push('list', 'main'));
});

test(`transitioning a nested element doesn't break a transitioning element`, t => {
const done = t.async();
let start = 0;

const Cmp = Ractive.extend({
template: '{{#if show}}<div go-out><button /></div>{{/if}}',
data() {
return { show: true };
},
transitions: {
go(trans) {
trans.setStyle('opacity', 1);
return trans.animateStyle('opacity', 0, { duration: 50 }).then(() => {
t.ok(+new Date() - start > 50, 'took at least 50ms');
});
}
},
css: `
button {
opacity: 1;
transition: opacity 10ms ease;
}
button.foo {
opacity: 0;
}
`
});

const r = new Cmp({
target: fixture
});

const btn = r.find('button');
start = new Date();
r.toggle('show').then(done);
btn.setAttribute('class', 'foo');
});
}

0 comments on commit 117273c

Please sign in to comment.