Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
VasilyStrelyaev committed Feb 21, 2025
1 parent b94c31b commit 470b764
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions packages/devextreme-react/src/core/__tests__/template.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -749,10 +749,10 @@ describe('component/render in nested options', () => {
const ItemTemplate = () => <div>Template</div>;
render(
<ComponentWithTemplates>
<NestedComponent itemTemplate='myTemplate'>
<NestedComponent item='myTemplate'>
<Template name='myTemplate' render={ItemTemplate} />
</NestedComponent>
<LeafNestedComponent itemTemplate='leafOptionTemplate'>
<LeafNestedComponent item='leafOptionTemplate'>
<Template name='leafOptionTemplate' render={ItemTemplate} />
</LeafNestedComponent>
</ComponentWithTemplates>,
Expand All @@ -761,20 +761,21 @@ describe('component/render in nested options', () => {
let options = WidgetClass.mock.calls[0][1];
let { integrationOptions } = options;

expect(integrationOptions.templates['option.item']).toBeDefined();
expect(typeof integrationOptions.templates['option.item']).toBe('string');
expect(typeof integrationOptions.templates['option.item'].render).toBe('function');
expect(integrationOptions.templates.myTemplate).toBeDefined();
expect(typeof integrationOptions.templates.myTemplate.render).toBe('function');

expect(integrationOptions.templates.leafOptionTemplate).toBeDefined();
expect(typeof integrationOptions.templates.leafOptionTemplate.render).toBe('function');

expect(integrationOptions.templates['leafOption.item']).toBeDefined();
expect(typeof integrationOptions.templates['leafOption.item']).toBe('string');
expect(typeof integrationOptions.templates['leafOption.item'].render).toBe('function');
expect(options.option.item).toBe('myTemplate');
expect(options.leafOption.item).toBe('leafOptionTemplate');

const MyCustomComponent = () => (
<>
<NestedComponent itemTemplate='myTemplate'>
<NestedComponent item='myTemplate'>
<Template name='myTemplate' render={ItemTemplate} />
</NestedComponent>
<LeafNestedComponent itemTemplate='leafOptionTemplate'>
<LeafNestedComponent item='leafOptionTemplate'>
<Template name='leafOptionTemplate' render={ItemTemplate} />
</LeafNestedComponent>
</>
Expand All @@ -789,13 +790,14 @@ describe('component/render in nested options', () => {
options = WidgetClass.mock.calls[1][1];
({ integrationOptions } = options);

expect(integrationOptions.templates['option.item']).toBeDefined();
expect(typeof integrationOptions.templates['option.item']).toBe('string');
expect(typeof integrationOptions.templates['option.item'].render).toBe('function');
expect(integrationOptions.templates.myTemplate).toBeDefined();
expect(typeof integrationOptions.templates.myTemplate.render).toBe('function');

expect(integrationOptions.templates.leafOptionTemplate).toBeDefined();
expect(typeof integrationOptions.templates.leafOptionTemplate.render).toBe('function');

expect(integrationOptions.templates['leafOption.item']).toBeDefined();
expect(typeof integrationOptions.templates['leafOption.item']).toBe('string');
expect(typeof integrationOptions.templates['leafOption.item'].render).toBe('function');
expect(options.option.item).toBe('myTemplate');
expect(options.leafOption.item).toBe('leafOptionTemplate');
});

it('pass integrationOptions options to widget with several templates', () => {
Expand Down

0 comments on commit 470b764

Please sign in to comment.