0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-02-17 22:44:24 -05:00

Fix examples smoke test fail (#8923)

This commit is contained in:
Bjorn Lu 2023-10-26 19:13:43 +08:00 committed by GitHub
parent c8976440ff
commit ec7f531682
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 31 deletions

View file

@ -14,10 +14,10 @@ import Container from '../components/Container.astro';
<script type="module" is:inline> <script type="module" is:inline>
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
console.log('loaded'); const form = document.querySelector('form');
document.querySelector('form').addEventListener('submit', (e) => { if (!form) throw new Error('Form not found');
form.addEventListener('submit', (e) => {
e.preventDefault(); e.preventDefault();
const form = e.target;
const formData = new FormData(form); const formData = new FormData(form);
const data = Object.fromEntries(formData); const data = Object.fromEntries(formData);
@ -26,10 +26,13 @@ import Container from '../components/Container.astro';
body: JSON.stringify(data), body: JSON.stringify(data),
}) })
.then((res) => res.json()) .then((res) => res.json())
.then((data) => { .then(() => {
document.querySelector('#result').innerHTML = const result = document.querySelector('#result');
'Progressive login was successful! you will be redirected to the store in 3 seconds'; if (result) {
setTimeout(() => (location.href = '/'), 3000); result.innerHTML =
'Progressive login was successful! you will be redirected to the store in 3 seconds';
setTimeout(() => (location.href = '/'), 3000);
}
}); });
}); });
}); });

View file

@ -64,7 +64,7 @@ export function get(context) {
// provide a base URL for RSS <item> links // provide a base URL for RSS <item> links
site: context.site, site: context.site,
// list of `<item>`s in output xml // list of `<item>`s in output xml
items: [...], items: [],
// (optional) absolute path to XSL stylesheet in your project // (optional) absolute path to XSL stylesheet in your project
stylesheet: '/rss-styles.xsl', stylesheet: '/rss-styles.xsl',
// (optional) inject custom xml // (optional) inject custom xml
@ -72,7 +72,7 @@ export function get(context) {
// (optional) add arbitrary metadata to opening <rss> tag // (optional) add arbitrary metadata to opening <rss> tag
xmlns: { h: 'http://www.w3.org/TR/html4/' }, xmlns: { h: 'http://www.w3.org/TR/html4/' },
// (optional) add trailing slashes to URLs (default: true) // (optional) add trailing slashes to URLs (default: true)
trailingSlash: false trailingSlash: false,
}); });
} }
``` ```
@ -98,9 +98,10 @@ The base URL to use when generating RSS item links. We recommend using the [endp
```ts ```ts
import rss from '@astrojs/rss'; import rss from '@astrojs/rss';
export const get = (context) => rss({ export const get = (context) =>
rss({
site: context.site, site: context.site,
... // ...
}); });
``` ```

View file

@ -2607,12 +2607,12 @@
```js ```js
import { defineConfig } from 'astro/config'; import { defineConfig } from 'astro/config';
export defaultdefineConfig({ export default defineConfig({
output: 'hybrid', output: 'hybrid',
experimental: { experimental: {
hybridOutput: true, hybridOutput: true,
}, },
}) });
``` ```
Then add `export const prerender = false` to any page or endpoint you want to opt-out of pre-rendering. Then add `export const prerender = false` to any page or endpoint you want to opt-out of pre-rendering.

View file

@ -210,12 +210,12 @@
```js ```js
import { defineConfig } from 'astro/config'; import { defineConfig } from 'astro/config';
export defaultdefineConfig({ export default defineConfig({
output: 'hybrid', output: 'hybrid',
experimental: { experimental: {
hybridOutput: true, hybridOutput: true,
}, },
}) });
``` ```
Then add `export const prerender = false` to any page or endpoint you want to opt-out of pre-rendering. Then add `export const prerender = false` to any page or endpoint you want to opt-out of pre-rendering.

View file

@ -553,12 +553,12 @@
```js ```js
import { defineConfig } from 'astro/config'; import { defineConfig } from 'astro/config';
export defaultdefineConfig({ export default defineConfig({
output: 'hybrid', output: 'hybrid',
experimental: { experimental: {
hybridOutput: true, hybridOutput: true,
}, },
}) });
``` ```
Then add `export const prerender = false` to any page or endpoint you want to opt-out of pre-rendering. Then add `export const prerender = false` to any page or endpoint you want to opt-out of pre-rendering.

View file

@ -209,7 +209,7 @@
}); });
``` ```
```js ```ts
// src/pages/_app.ts // src/pages/_app.ts
import type { App } from 'vue'; import type { App } from 'vue';
import i18nPlugin from '../plugins/i18n'; import i18nPlugin from '../plugins/i18n';

View file

@ -116,7 +116,7 @@ export default defineConfig({
}); });
``` ```
```js ```ts
// src/pages/_app.ts // src/pages/_app.ts
import type { App } from 'vue'; import type { App } from 'vue';
import i18nPlugin from 'my-vue-i18n-plugin'; import i18nPlugin from 'my-vue-i18n-plugin';