Hi
I have an Angular component that renders HotTable properly in the app runtime but exact same configuration setup does not render HotTable in the tests. What might be the issue ??
I am using hot-table wrapper and simply speaking it does not generate any table related dom besides main div wrapper
Each of our frameworks has its own tests. But generally, we do not have any examples or tutorials on how to create custom tests based on Handsontable. I have asked my colleague to share some feedback on that second topic you’ve created). And without any code samples, it is even harder to share some tips.
I should get his reply before the weekend if that is not a problem we can wait for his feedback and then get back to this issue. What do you think?
Sure, I am forcing my way trough some workarounds or test gaps. I will try to check it in a standalone project to exclude influence of app internals and if it will behave exactly the same way, I will share the code with you.
Since I am using HOT angular bindings, can I see the test code for those? It surely must contain similar scenario where table has to be displayed in the test (unless not Karma+Jasmine)
@admin turns out we dont have to look for examples as HOT tests are behaving the same way. I have cloned HOT repo, build and modified just a little bit one of existing tests should set 'settings' as a settings object and DOM is missing for whatever reasons. I would expect the table to be actually visible. As you can see below, wrapper contains only an empty div`
fit(`should set 'settings' as a settings object`, async () => {
TestBed.overrideComponent(TestComponent, {
set: {
template: `
I am between here>
<hot-table [hotId]="id" [settings]="prop.settings"></hot-table>< and here
`
}
});
await TestBed.compileComponents().then(() => {
fixture = TestBed.createComponent(TestComponent);
const app = fixture.componentInstance;
app.prop['settings'] = {
data: [
["A1", "B1", "C1"],
["A2", "B2", "C2"]
]
};
fixture.detectChanges();
expect(app.getHotInstance(app.id).getDataAtCell(0, 0)).toBe('A1');
fail();
});
});
So it was due to afterEach step. After removing it works as expected in HOT tests. Suprisingly my own tests are now rendering HOT propertly with styling etc but I had no cleanup phase there. What did change is that I had to update NodeJS and NPM to match build requirements for HOT. I have no idea if that was the case (older tools) or I did something else which fixed the issue for me…