Posted 23 August 2021, 8:25 am EST
- Updated 3 October 2022, 12:43 pm EST
hi Sharad,
yes, the error still occurring please see below my code
code to test
toggleDetail(row, dp) {
console.log("toggle detail row", row);
console.log("toggle detail dp", dp);
if (dp.isDetailVisible(row)) {
dp.hideDetail(row);
} else {
dp.showDetail(row);
}
}
test code
import { WjFlexGrid, WjGridModule } from '@grapecity/wijmo.angular2.grid';
import {
WjGridDetailModule,
WjFlexGridDetail,
} from '@grapecity/wijmo.angular2.grid.detail';
import * as wjcCore from '@grapecity/wijmo';
describe('mycomponent', () => {
let component: ExchangeRateSourceComponent;
let fixture: ComponentFixture<ExchangeRateSourceComponent>;
let gridDetail: WjFlexGridDetail;
let gridDetailDebug: DebugElement;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
BrowserModule,
FormsModule,
RouterTestingModule,
TranslateModule.forRoot({}),
HttpClientModule,
WjGridModule,
WjGridDetailModule,
],
declarations: [ExchangeRateSourceComponent],
providers: [
ExchangeRateSourceComponent,
FlexgridsetupService,
PlatformConfigService,
BentoModalConfirmationService,
ModalsService,
TranslateService,
{ provide: ActivatedRoute, useValue: activatedRouteMock },
{ provide: Router, useValue: mockRouter },
],
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ExchangeRateSourceComponent);
component = fixture.componentInstance;
//grid init
appComDebugElement = fixture.debugElement;
gridDetailDebug = appComDebugElement.query(By.directive(WjFlexGridDetail));
gridDetail = gridDetailDebug.componentInstance;
//end grid init
fixture.detectChanges();
});
describe('toggleDetail', () => {
it('should be able to toggle details', () => {
let row = {
index: 0,
size: null
}
component.toggleDetail(row,gridDetail);
});
});
})
grid detaikl on HTML
<ng-template
wjFlexGridDetail
#dp="wjFlexGridDetail"
[detailVisibilityMode]="'Code'"
let-item="item"
>
<div class="table-cell width-full">
<p class="wrap-description">
{{ item.description }}
</p>
</div>
</ng-template>
but the error occurrs on the part for the debug element