From a9f7cb441e29fcb7cfeecafc9825974541f6a2c2 Mon Sep 17 00:00:00 2001 From: Ben Weis Date: Fri, 7 Jul 2023 13:45:05 -0400 Subject: [PATCH] fix tests after merge --- README.md | 18 +-- test/__snapshots__/format.test.js.snap | 193 +++++++++++-------------- test/format.test.js | 2 + 3 files changed, 92 insertions(+), 121 deletions(-) diff --git a/README.md b/README.md index f113621..1e65e64 100644 --- a/README.md +++ b/README.md @@ -46,16 +46,16 @@ The `prettier` executable is now installed and ready for use: Below are the options (from [`src/plugin.js`](src/plugin.js)) that `@prettier/plugin-xml` currently supports: -| API Option | CLI Option | Default | Description | -| -------------------------- | ------------------------------ | :--------: | ------------------------------------------------------------------------------------------------------------------------ | --- | -| `bracketSameLine` | `--bracket-same-line` | `true` | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#bracket-same-line)) | -| `printWidth` | `--print-width` | `80` | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#print-width)). | -| `singleAttributePerLine` | `--single-attribute-per-line` | `false` | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#single-attribute-per-line)) | | -| `tabWidth` | `--tab-width` | `2` | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#tab-width)). | +| API Option | CLI Option | Default | Description | +| -------------------------- | ------------------------------ | :----------: | ------------------------------------------------------------------------------------------------------------------------ | --- | +| `bracketSameLine` | `--bracket-same-line` | `true` | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#bracket-same-line)) | +| `printWidth` | `--print-width` | `80` | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#print-width)). | +| `singleAttributePerLine` | `--single-attribute-per-line` | `false` | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#single-attribute-per-line)) | | +| `tabWidth` | `--tab-width` | `2` | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#tab-width)). | | `xmlQuoteAttributes` | `--xml-quote-attributes` | `"preserve"` | Options are `"preserve"`, `"single"`, and `"double"` | -| `xmlSelfClosingSpace` | `--xml-self-closing-space` | `true` | Adds a space before self-closing tags. | -| `xmlSortAttributesByKey` | `--xml-sort-attributes-by-key` | `false` | Orders XML attributes by key alphabetically while prioritizing xmlns attributes. | -| `xmlWhitespaceSensitivity` | `--xml-whitespace-sensitivity` | `"strict"` | Options are `"strict"`, `"preserve"`, and `"ignore"`. You may want `"ignore"` or `"preserve"`, [see below](#whitespace). | +| `xmlSelfClosingSpace` | `--xml-self-closing-space` | `true` | Adds a space before self-closing tags. | +| `xmlSortAttributesByKey` | `--xml-sort-attributes-by-key` | `false` | Orders XML attributes by key alphabetically while prioritizing xmlns attributes. | +| `xmlWhitespaceSensitivity` | `--xml-whitespace-sensitivity` | `"strict"` | Options are `"strict"`, `"preserve"`, and `"ignore"`. You may want `"ignore"` or `"preserve"`, [see below](#whitespace). | Any of these can be added to your existing [prettier configuration file](https://prettier.io/docs/en/configuration.html). For example: diff --git a/test/__snapshots__/format.test.js.snap b/test/__snapshots__/format.test.js.snap index 87e799e..7105dee 100644 --- a/test/__snapshots__/format.test.js.snap +++ b/test/__snapshots__/format.test.js.snap @@ -595,6 +595,33 @@ use {
+ +
+ + + + + + He said, "Don't quote me." @@ -687,6 +714,33 @@ use {
+ +
+ + + + + + He said, "Don't quote me." @@ -779,6 +833,33 @@ use {
+ +
+ + + + + + He said, "Don't quote me." @@ -907,118 +988,6 @@ use { /> - - -" -`; - -exports[`xmlSortAttributesByKey => true 1`] = ` -" - - - - - Style inheritance and the use element - - &anp; 〹 - - foo - - bar - - - - - - - - - -- 1 - - 2 -- 3 - - - - - - - - - - - - < ignored /> - - -

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed at est eget enim consectetur accumsan. Aliquam pretium sodales ipsum quis dignissim. Sed id sem vel diam luctus fringilla. Aliquam quis egestas magna. Curabitur molestie lorem et odio porta, et molestie libero laoreet. Morbi rhoncus sagittis cursus. Nullam vehicula pretium consequat. Praesent porta ante at posuere sollicitudin. Nullam commodo tempor arcu, at condimentum neque elementum ut. -

- - content - - -
text with space

- -
- even more - -
- -
- -
- - -
- - - - - - He said, "Don't quote me." diff --git a/test/format.test.js b/test/format.test.js index 609dbca..ebaa16d 100644 --- a/test/format.test.js +++ b/test/format.test.js @@ -76,6 +76,7 @@ test("xmlSortAttributesByKey => true", async () => { const formatted = await format(fixture, { xmlSortAttributesByKey: true }); +}); test("xmlQuoteAttributes => preserve", async () => { const formatted = await format(fixture, { @@ -97,5 +98,6 @@ test("xmlQuoteAttributes => double", async () => { const formatted = await format(fixture, { xmlQuoteAttributes: "double" }); + expect(formatted).toMatchSnapshot(); });