Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions e2e/testcafe-devextreme/tests/cardView/cardHeader.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import CardView from 'devextreme-testcafe-models/cardView';
import url from '../../helpers/getPageUrl';
import { createWidget } from '../../helpers/createWidget';

fixture.disablePageReloads`CardView - Card Header`
.page(url(__dirname, '../container.html'));

const CARD_VIEW_SELECTOR = '#container';

test('cardHeader item with a named template should render the template content (T1328152)', async (t) => {
const cardView = new CardView(CARD_VIEW_SELECTOR);

await t.expect(cardView.isReady()).ok();

await t.expect(cardView.getCard(0).getToolbarItemContent(0).textContent).eql('custom_content');
}).before(async () => createWidget('dxCardView', {
dataSource: [
{ id: 1 },
],
keyExpr: 'id',
cardHeader: {
visible: true,
items: [
{ template: 'myTemplate' },
],
},
templatesRenderAsynchronously: true,
integrationOptions: {
templates: {
myTemplate: {
render(e) {
setTimeout(() => {
$('<div>').text('custom_content').appendTo(e.container);
e.onRendered?.();
}, 100);
},
},
},
},
}));
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,15 @@ function MainViewComponent({
export class MainView extends View<MainViewProps> {
protected override component = MainViewComponent;

private readonly integrationOptions = computed(() => ({
templates: this.options.oneWay('integrationOptions.templates').value,
}));

private readonly config = computed(() => ({
rtlEnabled: this.options.oneWay('rtlEnabled').value,
disabled: this.options.oneWay('disabled').value,
templatesRenderAsynchronously: this.options.oneWay('templatesRenderAsynchronously').value,
integrationOptions: this.integrationOptions.value,
}));

private readonly commonProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ export interface Config {
rtlEnabled: WidgetProperties['rtlEnabled'];
disabled: WidgetProperties['disabled'];
templatesRenderAsynchronously: unknown; // TODO: Properties['templatesRenderAsynchronously'];
integrationOptions: Pick<NonNullable<WidgetProperties['integrationOptions']>, 'templates'> | undefined;
}

export const ConfigContext = createContext<Config>({
rtlEnabled: undefined,
disabled: undefined,
templatesRenderAsynchronously: undefined,
integrationOptions: undefined,
});
Loading