File tree Expand file tree Collapse file tree 7 files changed +617
-37
lines changed
Filter options
Expand file tree Collapse file tree 7 files changed +617
-37
lines changed
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div class =" p-4 mt-4 mb-4 rounded-lg alert text-sm leading-relaxed" :class =" [type]" >
3
3
<div class =" flex items-start" >
4
- <InjectComponent
4
+ <div
5
5
v-if =" icon"
6
6
:component =" icon"
7
7
class =" inline-flex mr-2 w-5 h-5 justify-center items-center text-1.2rem"
8
8
>
9
9
{{ icon }}
10
10
11
- </InjectComponent >
11
+ </div >
12
12
<slot />
13
13
<div class =" flex-grow alert-content" >
14
- <Markdown unwrap =" p" >
14
+ <ContentSlot unwrap =" p" >
15
15
<template #between >
16
16
<br > <slot />
17
17
</template >
18
- </Markdown >
18
+ </ContentSlot >
19
19
</div >
20
20
</div >
21
21
</div >
@@ -44,79 +44,68 @@ export default defineComponent({
44
44
.alert {
45
45
& .success {
46
46
@apply bg-green-50 dark :bg-green-800 dark:bg-opacity-25 text-green-600 dark:text-green-200;
47
- >>> {
48
- code {
47
+ :deep (code) {
49
48
@apply bg-green-100 dark :bg-green-900 dark:bg-opacity-50 shadow-none text-current;
50
49
}
51
50
a:hover {
52
51
code {
53
52
@apply border-green-400 dark :border-green-700;
54
53
}
55
- }
56
54
}
57
55
}
58
56
& .info {
59
57
@apply bg-blue-50 dark :bg-blue-800 dark:bg-opacity-25 text-blue-600 dark:text-blue-200;
60
- >>> {
61
- code {
58
+ :deep (code) {
62
59
@apply bg-blue-100 dark :bg-blue-900 dark:bg-opacity-50 shadow-none text-current;
63
60
}
64
61
a:hover {
65
62
code {
66
63
@apply border-blue-400 dark :border-blue-700;
67
64
}
68
- }
69
65
}
70
66
}
71
67
& .warning {
72
68
@apply bg-yellow-50 dark :bg-yellow-800 dark:bg-opacity-25 text-yellow-600 dark:text-yellow-100;
73
- >>> {
74
- code {
69
+ :deep (code) {
75
70
@apply bg-yellow-100 dark :bg-yellow-900 dark:bg-opacity-50 shadow-none text-current;
76
71
}
77
72
a:hover {
78
73
code {
79
74
@apply border-yellow-400 dark :border-yellow-700;
80
75
}
81
76
}
82
- }
77
+
83
78
}
84
79
& .danger {
85
80
@apply bg-red-50 dark :bg-red-800 dark:bg-opacity-25 text-red-600 dark:text-red-100;
86
- >>> {
87
- code {
81
+ :deep (code) {
88
82
@apply bg-red-100 dark :bg-red-900 dark:bg-opacity-50 shadow-none text-current;
89
83
}
90
84
a:hover {
91
85
code {
92
86
@apply border-red-400 dark :border-red-700;
93
87
}
94
88
}
95
- }
96
89
}
97
90
98
- >>> {
99
- strong {
91
+ :deep (strong) {
100
92
@apply font-semibold text-current;
101
93
}
102
94
a {
103
95
@apply underline border-none font-semibold text-current;
104
96
code {
105
97
@apply border border-transparent border-dashed;
106
98
}
107
- }
108
99
}
109
100
}
110
101
111
- .alert >>> p {
102
+ .alert : deep (p) {
112
103
@apply m-0 !important ;
113
104
}
114
105
115
106
.dark .alert {
116
- >>> {
117
- a {
107
+ :deep (a) {
118
108
@apply text-current;
119
109
}
120
- }
121
110
}
122
111
</style >
Original file line number Diff line number Diff line change @@ -25,10 +25,12 @@ Every time we visit or refresh **localhost:3000/api/counter** the count will in
25
25
You may be tempted to believe that if the count survived a browser refresh, it must must persistent, right?
26
26
We must keep in mind, the browser is not the only thing that can restart. The server can as well.
27
27
28
- :: alert { type = danger icon =🚨 }
28
+ :: alert { background = bg-purple-800 icon =🚨 }
29
29
Don't let this fool you into thinking this is persistent state. As soon as you restart the server, the count will be back to 0!
30
30
::
31
31
32
+
33
+
32
34
``` js [/api/counter.ts]
33
35
let count = 0
34
36
Original file line number Diff line number Diff line change 1
1
2
2
// https://v3.nuxtjs.org/api/configuration/nuxt.config
3
3
export default defineNuxtConfig ( {
4
- modules : [ '@nuxtjs/tailwindcss' , '@nuxtjs/color-mode' , '@nuxt/content' ] ,
4
+ modules : [ '@nuxtjs/tailwindcss' , '@nuxtjs/color-mode' , '@nuxt/content' , 'nuxt-icon' ] ,
5
5
tailwindcss : {
6
6
cssPath : '~/assets/css/tailwind.css' ,
7
7
configPath : 'tailwind.config.js' ,
Original file line number Diff line number Diff line change 5
5
"dev" : " nuxt dev" ,
6
6
"generate" : " nuxt generate" ,
7
7
"preview" : " nuxt preview" ,
8
- "test" : " echo todo " ,
8
+ "test" : " vitest " ,
9
9
"prisma:generate" : " dotenv -e .env -- npx prisma generate" ,
10
10
"prisma:migrate" : " dotenv -e .env -- npx prisma migrate deploy --name prod"
11
11
},
12
12
"devDependencies" : {
13
13
"@nuxt/content" : " ^2.1.1" ,
14
14
"@nuxt/postcss8" : " ^1.1.3" ,
15
+ "@nuxt/test-utils-edge" : " ^3.0.0-rc.13-27777092.59d8c51" ,
15
16
"@nuxtjs/color-mode" : " ^3.1.8" ,
16
17
"@nuxtjs/tailwindcss" : " ^6.0.1" ,
17
18
"@types/bcrypt" : " ^5.0.0" ,
18
19
"@types/uuid" : " ^8.3.4" ,
19
20
"autoprefixer" : " ^10.4.12" ,
21
+ "jsdom" : " ^20.0.1" ,
20
22
"nuxt" : " ^3.0.0-rc.12" ,
23
+ "nuxt-icon" : " ^0.1.7" ,
21
24
"postcss" : " ^8.4.18" ,
22
- "tailwindcss" : " ^3.2.1"
25
+ "tailwindcss" : " ^3.2.1" ,
26
+ "vitest" : " ^0.24.3"
23
27
},
24
28
"dependencies" : {
25
29
"@formkit/auto-animate" : " ^1.0.0-beta.3" ,
Original file line number Diff line number Diff line change
1
+ import { describe , it , expect } from 'vitest'
2
+ import { fileURLToPath } from 'node:url'
3
+ import { setup , $fetch } from '@nuxt/test-utils-edge'
4
+ describe ( 'ssr' , async ( ) => {
5
+ await setup ( {
6
+ rootDir : fileURLToPath ( new URL ( './fixture' , import . meta. url ) ) ,
7
+ } )
8
+ it ( 'renders the index page' , async ( ) => {
9
+ // Get response to a server-rendered page with `$fetch`.
10
+ const html = await $fetch ( '/' )
11
+ expect ( html ) . toContain ( 'Full Stack' )
12
+ } )
13
+ } )
Original file line number Diff line number Diff line change
1
+ import { defineConfig } from "vitest/config" ;
2
+ export default defineConfig ( {
3
+ test : {
4
+ environment : "jsdom" ,
5
+ deps : {
6
+ inline : [ / @ n u x t \/ t e s t - u t i l s - e d g e / ] ,
7
+ } ,
8
+ } ,
9
+ } )
You can’t perform that action at this time.
0 commit comments