Skip to content

Commit

Permalink
fix: worked around the issue for legacy component rerenders
Browse files Browse the repository at this point in the history
  • Loading branch information
oxala committed Sep 24, 2018
1 parent ea7bf50 commit 208b34f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const stackTrace = require('stack-trace');
const clone = require('just-clone');
const markoModulesMockingMap = require('../marko-modules-mocking-map');

delete global.WeakMap;

Object.keys(markoModulesMockingMap)
.forEach(moduleToMock => jest.mock(
moduleToMock,
Expand Down
20 changes: 10 additions & 10 deletions tests/components/legacy/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ beforeEach(() => {
window.alert = jest.fn();
});

describe('When component is rendered with data', () => {
describe('When legacy component is rendered with data', () => {
let component;

beforeEach(() => {
Expand All @@ -19,14 +19,14 @@ describe('When component is rendered with data', () => {
expect(window.alert).toBeCalledWith(fixtures.index.visible);
});

// describe('When user clicks the button', () => {
// beforeEach((done) => {
// component.getEl('button').click();
// component.once('update', done);
// });
describe('When user clicks the button', () => {
beforeEach((done) => {
component.getEl('button').click();
component.once('update', done);
});

// it('should set change the state and rerender the template', () => {
// expect(component.state.visible).toBe(false);
// });
// });
it('should set change the state and rerender the template', () => {
expect(component.state.visible).toBe(false);
});
});
});

0 comments on commit 208b34f

Please sign in to comment.