add mock for updateSettings when testing TableBlock

pull/10421/head
Matt Westcott 2023-05-15 15:29:11 +01:00
rodzic 31948fc9db
commit 8b32acb2ad
1 zmienionych plików z 6 dodań i 0 usunięć

Wyświetl plik

@ -67,6 +67,7 @@ describe('telepath: wagtail.widgets.TableInput', () => {
let testValue;
let handsontableConstructorMock;
let renderMock;
let updateSettingsMock;
// Call this to render the table block with the current settings
const render = () => {
@ -84,6 +85,7 @@ describe('telepath: wagtail.widgets.TableInput', () => {
beforeEach(() => {
handsontableConstructorMock = jest.fn();
renderMock = jest.fn();
updateSettingsMock = jest.fn();
class HandsontableMock {
constructor(...args) {
@ -93,6 +95,10 @@ describe('telepath: wagtail.widgets.TableInput', () => {
render() {
renderMock();
}
updateSettings(opts) {
updateSettingsMock(opts);
}
}
window.Handsontable = HandsontableMock;