Initial commit of 001code-html Scratch frontend project.

Includes scratch-gui, scratch-vm, scratch-blocks, scratch-render, scratch-l10n, and deployment config.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-16 15:37:45 +08:00
commit 6e0a1fbcbb
11350 changed files with 965674 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
import React from 'react';
import {Provider} from 'react-redux';
const {mountWithIntl} = require('../../helpers/intl-helpers.jsx');
import configureStore from 'redux-mock-store';
import CrashMessageComponent from '../../../src/components/crash-message/crash-message.jsx';
import ErrorBoundary from '../../../src/containers/error-boundary.jsx';
const ChildComponent = () => <div>hello</div>;
describe('ErrorBoundary', () => {
const mockStore = configureStore();
let store;
beforeEach(() => {
store = mockStore({
locales: {
isRtl: false,
locale: 'en-US'
}
});
});
test('ErrorBoundary shows children before error and CrashMessageComponent after', () => {
const child = <ChildComponent />;
const wrapper = mountWithIntl(
<Provider store={store}><ErrorBoundary action="test">{child}</ErrorBoundary></Provider>
);
const errorSite = wrapper.childAt(0).childAt(0);
// @ts-ignore: 'onReload' prop is absent because this component will only be used for pattern matching
const crashMessagePattern = <CrashMessageComponent />;
expect(wrapper.containsMatchingElement(child)).toBeTruthy();
expect(wrapper.containsMatchingElement(crashMessagePattern)).toBeFalsy();
errorSite.simulateError(new Error('fake error for testing purposes'));
expect(wrapper.containsMatchingElement(child)).toBeFalsy();
expect(wrapper.containsMatchingElement(crashMessagePattern)).toBeTruthy();
});
});