Skip to content

Commit

Permalink
Mock module
Browse files Browse the repository at this point in the history
  • Loading branch information
shoonia committed Dec 2, 2024
1 parent 4a26417 commit 16fb08c
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsx-dom-runtime",
"version": "0.71.0",
"version": "0.71.0-dev.3",
"description": "A tiny in 500 bytes library to JSX syntax templates for DOM. Support HTML, SVG and MathML tags",
"type": "module",
"main": "jsx-runtime/index.cjs",
Expand Down
2 changes: 1 addition & 1 deletion rollup.build.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const buildPlugins = async (plugins) => {
esModule: false,
},
],
external: ['../../jsx-runtime'],
external: ['jsx-dom-runtime'],
plugins,
};
}),
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/dataset/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { extensions } from '../../jsx-runtime';
import { extensions } from 'jsx-dom-runtime';

export const initDataset = () => /*#__PURE__*/
extensions.set('dataset', (
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/html/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { properties } from '../../jsx-runtime';
import { properties } from 'jsx-dom-runtime';

export const initHtml = () => /*#__PURE__*/
properties
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/media/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { properties } from '../../jsx-runtime';
import { properties } from 'jsx-dom-runtime';

export const initMedia = () => /*#__PURE__*/
properties
Expand Down
8 changes: 6 additions & 2 deletions src/plugins/style/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { extensions } from '../../jsx-runtime';
import { extensions } from 'jsx-dom-runtime';

export const initStyle = () => /*#__PURE__*/
extensions.set('style', (node, value, key) => {
extensions.set('style', (
node: HTMLElement | SVGAElement | MathMLElement,
value: object,
key: string,
) => {
if (typeof value == 'string') {
node.setAttribute(key, value);
} else {
Expand Down
4 changes: 4 additions & 0 deletions tests/utils/jest-setup.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import '@testing-library/jest-dom';
import { diffStringsUnified } from 'jest-diff';
import { jest } from '@jest/globals';

import { t } from './t';
import * as jsxRuntime from '../../jsx-runtime';

beforeEach(() => {
document.head.innerHTML = '';
document.body.innerHTML = '';
});

jest.unstable_mockModule('jsx-dom-runtime', () => jsxRuntime);

expect.extend({
toHaveOuterHTML(node: HTMLElement, html: string) {
const val = node.outerHTML;
Expand Down

0 comments on commit 16fb08c

Please sign in to comment.