Skip to content

Commit

Permalink
WRO-266: Unskip one of Skinnable unit test cases (#3056)
Browse files Browse the repository at this point in the history
* updated skipped test for Skinnable

* lint warning fixes

* lint warning fixes

* Update unit test

Enact-DCO-1.0-Signed-off-by: Seungcheon Baek (sc.baek@lge.com)

* Fix lint warnings

Enact-DCO-1.0-Signed-off-by: Seungcheon Baek (sc.baek@lge.com)

Co-authored-by: Daniel Stoian <daniel.stoian@lgepartner.com>
  • Loading branch information
0x64 and daniel-stoian-lgp committed May 13, 2022
1 parent b4b5904 commit 217690f
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions packages/ui/Skinnable/tests/Skinnable-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ describe('Skinnable Specs', () => {
expect(component).toHaveClass(expected);
});

test.skip('should not force re-render of child if child unaffected', () => {
test('should not force re-render of child if child unaffected', () => {
const config = {
defaultSkin: 'dark',
defaultVariants: 'normal',
Expand All @@ -400,19 +400,33 @@ describe('Skinnable Specs', () => {
const SkinnableParent = Skinnable(config, Component);
const SkinnableChild = Skinnable(config, ChildComponent);

// eslint-disable-next-line
const subject = mount(
const childrenProp = (<SkinnableChild />);

const {rerender} = render(
<SkinnableParent>
<SkinnableChild />
{childrenProp}
</SkinnableParent>
);

rerender(
<SkinnableParent className="foo">
{childrenProp}
</SkinnableParent>
);

// Sending props to force parent to re-render
subject.setProps({className: 'foo'});
const expected1 = 1;
const actual1 = wasRendered.mock.calls.length;

rerender(
<SkinnableParent className="foo" skin="light">
{childrenProp}
</SkinnableParent>
);

const expected = 1;
const actual = wasRendered.mock.calls.length;
const expected2 = 2;
const actual2 = wasRendered.mock.calls.length;

expect(actual).toEqual(expected);
expect(actual1).toEqual(expected1);
expect(actual2).toEqual(expected2);
});
});

0 comments on commit 217690f

Please sign in to comment.