Skip to content

Commit

Permalink
Merge pull request #368 from preactjs/jsx-extension
Browse files Browse the repository at this point in the history
chore: use `.jsx` extension for files with JSX
  • Loading branch information
marvinhagemeister authored May 29, 2024
2 parents d3659b8 + 1cfddea commit 14b014a
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 33 deletions.
44 changes: 15 additions & 29 deletions test/compat/async.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { renderToStringAsync } from '../../src/index.js';
import { h } from 'preact';
import { Suspense, useId } from 'preact/compat';
import { expect } from 'chai';
import { createSuspender } from '../utils.js';
import { createSuspender } from '../utils.jsx';

describe('Async renderToString', () => {
it('should render JSX after a suspense boundary', async () => {
Expand All @@ -26,14 +26,10 @@ describe('Async renderToString', () => {
});

it('should render JSX with nested suspended components', async () => {
const {
Suspender: SuspenderOne,
suspended: suspendedOne
} = createSuspender();
const {
Suspender: SuspenderTwo,
suspended: suspendedTwo
} = createSuspender();
const { Suspender: SuspenderOne, suspended: suspendedOne } =
createSuspender();
const { Suspender: SuspenderTwo, suspended: suspendedTwo } =
createSuspender();

const promise = renderToStringAsync(
<ul>
Expand All @@ -60,14 +56,10 @@ describe('Async renderToString', () => {
});

it('should render JSX with nested suspense boundaries', async () => {
const {
Suspender: SuspenderOne,
suspended: suspendedOne
} = createSuspender();
const {
Suspender: SuspenderTwo,
suspended: suspendedTwo
} = createSuspender();
const { Suspender: SuspenderOne, suspended: suspendedOne } =
createSuspender();
const { Suspender: SuspenderTwo, suspended: suspendedTwo } =
createSuspender();

const promise = renderToStringAsync(
<ul>
Expand Down Expand Up @@ -96,18 +88,12 @@ describe('Async renderToString', () => {
});

it('should render JSX with multiple suspended direct children within a single suspense boundary', async () => {
const {
Suspender: SuspenderOne,
suspended: suspendedOne
} = createSuspender();
const {
Suspender: SuspenderTwo,
suspended: suspendedTwo
} = createSuspender();
const {
Suspender: SuspenderThree,
suspended: suspendedThree
} = createSuspender();
const { Suspender: SuspenderOne, suspended: suspendedOne } =
createSuspender();
const { Suspender: SuspenderTwo, suspended: suspendedTwo } =
createSuspender();
const { Suspender: SuspenderThree, suspended: suspendedThree } =
createSuspender();

const promise = renderToStringAsync(
<ul>
Expand Down
2 changes: 1 addition & 1 deletion test/context.test.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import render from '../src/jsx.js';
import { h, createContext, Component } from 'preact';
import { expect } from 'chai';
import { dedent } from './utils.js';
import { dedent } from './utils.jsx';

describe('context', () => {
let renderJsx = (jsx, opts) => render(jsx, null, opts).replace(/ {2}/g, '\t');
Expand Down
2 changes: 1 addition & 1 deletion test/jsx.test.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import render from '../src/jsx.js';
import { h } from 'preact';
import { expect } from 'chai';
import { dedent } from './utils.js';
import { dedent } from './utils.jsx';

describe('jsx', () => {
let renderJsx = (jsx, opts) => render(jsx, null, opts).replace(/ {2}/g, '\t');
Expand Down
2 changes: 1 addition & 1 deletion test/pretty.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import basicRender from '../src/index.js';
import { render } from '../src/jsx.js';
import { h, Fragment } from 'preact';
import { expect } from 'chai';
import { dedent, svgAttributes, htmlAttributes } from './utils.js';
import { dedent, svgAttributes, htmlAttributes } from './utils.jsx';

describe('pretty', () => {
let prettyRender = (jsx, opts) => render(jsx, {}, { pretty: true, ...opts });
Expand Down
2 changes: 1 addition & 1 deletion test/render.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
} from 'preact/hooks';
import { expect } from 'chai';
import { spy, stub, match } from 'sinon';
import { svgAttributes, htmlAttributes } from './utils.js';
import { svgAttributes, htmlAttributes } from './utils.jsx';

function shallowRender(vnode) {
const context = {};
Expand Down
File renamed without changes.

0 comments on commit 14b014a

Please sign in to comment.