🌐 AI搜索 & 代理 主页
Skip to content

Commit 03e71c7

Browse files
Merge branch 'dev' into ag/6306
2 parents 319b6a7 + 5d64a65 commit 03e71c7

File tree

6 files changed

+144
-55
lines changed

6 files changed

+144
-55
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
"@babel/standalone": "^7.12.12",
100100
"@nuxt/content": "^1.11.1",
101101
"@nuxtjs/google-analytics": "^2.4.0",
102-
"@nuxtjs/pwa": "^3.3.4",
102+
"@nuxtjs/pwa": "^3.3.5",
103103
"@nuxtjs/robots": "^2.4.2",
104104
"@nuxtjs/sitemap": "^2.4.0",
105105
"@testing-library/jest-dom": "^5.11.9",
@@ -110,7 +110,7 @@
110110
"babel-jest": "^26.6.3",
111111
"babel-plugin-istanbul": "^6.0.0",
112112
"bootstrap-icons": "^1.3.0",
113-
"bundlewatch": "^0.3.1",
113+
"bundlewatch": "^0.3.2",
114114
"clean-css-cli": "^4.3.0",
115115
"codemirror": "^5.59.2",
116116
"codesandbox": "^2.2.1",
@@ -137,7 +137,7 @@
137137
"lint-staged": "^10.5.3",
138138
"loader-utils": "^2.0.0",
139139
"lodash": "^4.17.20",
140-
"marked": "^1.2.7",
140+
"marked": "^1.2.8",
141141
"nuxt": "^2.14.12",
142142
"postcss": "^8.2.4",
143143
"postcss-cli": "^8.3.1",

src/components/form-checkbox/form-checkbox-group.spec.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,60 @@ describe('form-checkbox-group', () => {
184184
wrapper.destroy()
185185
})
186186

187+
it('has checkboxes with input validation class "is-valid" when `state` is `true`', async () => {
188+
const wrapper = mount(BFormCheckboxGroup, {
189+
attachTo: createContainer(),
190+
propsData: {
191+
options: ['one', 'two', 'three'],
192+
checked: '',
193+
state: true
194+
}
195+
})
196+
197+
const $checkboxes = wrapper.findAll('input[type=checkbox]')
198+
expect($checkboxes.length).toBe(3)
199+
expect($checkboxes.wrappers.every(c => c.classes().includes('is-valid'))).toBe(true)
200+
expect($checkboxes.wrappers.every(c => c.classes().includes('is-invalid'))).toBe(false)
201+
202+
wrapper.destroy()
203+
})
204+
205+
it('has checkboxes with input validation class "is-invalid" when `state` is `false`', async () => {
206+
const wrapper = mount(BFormCheckboxGroup, {
207+
attachTo: createContainer(),
208+
propsData: {
209+
options: ['one', 'two', 'three'],
210+
checked: '',
211+
state: false
212+
}
213+
})
214+
215+
const $checkboxes = wrapper.findAll('input[type=checkbox]')
216+
expect($checkboxes.length).toBe(3)
217+
expect($checkboxes.wrappers.every(c => c.classes().includes('is-valid'))).toBe(false)
218+
expect($checkboxes.wrappers.every(c => c.classes().includes('is-invalid'))).toBe(true)
219+
220+
wrapper.destroy()
221+
})
222+
223+
it('has checkboxes with no input validation class when `state` is `null`', async () => {
224+
const wrapper = mount(BFormCheckboxGroup, {
225+
attachTo: createContainer(),
226+
propsData: {
227+
options: ['one', 'two', 'three'],
228+
checked: '',
229+
state: null
230+
}
231+
})
232+
233+
const $checkboxes = wrapper.findAll('input[type=checkbox]')
234+
expect($checkboxes.length).toBe(3)
235+
expect($checkboxes.wrappers.every(c => c.classes().includes('is-valid'))).toBe(false)
236+
expect($checkboxes.wrappers.every(c => c.classes().includes('is-invalid'))).toBe(false)
237+
238+
wrapper.destroy()
239+
})
240+
187241
// --- Button mode structure ---
188242

189243
it('button mode has classes button-group and button-group-toggle', async () => {

src/components/form-radio/form-radio-group.spec.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,60 @@ describe('form-radio-group', () => {
167167
wrapper.destroy()
168168
})
169169

170+
it('has radios with input validation class "is-valid" when `state` is `true`', async () => {
171+
const wrapper = mount(BFormRadioGroup, {
172+
attachTo: createContainer(),
173+
propsData: {
174+
options: ['one', 'two', 'three'],
175+
checked: '',
176+
state: true
177+
}
178+
})
179+
180+
const $radios = wrapper.findAll('input[type=radio]')
181+
expect($radios.length).toBe(3)
182+
expect($radios.wrappers.every(c => c.classes().includes('is-valid'))).toBe(true)
183+
expect($radios.wrappers.every(c => c.classes().includes('is-invalid'))).toBe(false)
184+
185+
wrapper.destroy()
186+
})
187+
188+
it('has radios with input validation class "is-invalid" when `state` is `false`', async () => {
189+
const wrapper = mount(BFormRadioGroup, {
190+
attachTo: createContainer(),
191+
propsData: {
192+
options: ['one', 'two', 'three'],
193+
checked: '',
194+
state: false
195+
}
196+
})
197+
198+
const $radios = wrapper.findAll('input[type=radio]')
199+
expect($radios.length).toBe(3)
200+
expect($radios.wrappers.every(c => c.classes().includes('is-valid'))).toBe(false)
201+
expect($radios.wrappers.every(c => c.classes().includes('is-invalid'))).toBe(true)
202+
203+
wrapper.destroy()
204+
})
205+
206+
it('has radios with no input validation class when `state` is `null`', async () => {
207+
const wrapper = mount(BFormRadioGroup, {
208+
attachTo: createContainer(),
209+
propsData: {
210+
options: ['one', 'two', 'three'],
211+
checked: '',
212+
state: null
213+
}
214+
})
215+
216+
const $radios = wrapper.findAll('input[type=radio]')
217+
expect($radios.length).toBe(3)
218+
expect($radios.wrappers.every(c => c.classes().includes('is-valid'))).toBe(false)
219+
expect($radios.wrappers.every(c => c.classes().includes('is-invalid'))).toBe(false)
220+
221+
wrapper.destroy()
222+
})
223+
170224
// --- Button mode structure ---
171225

172226
it('button mode has classes button-group and button-group-toggle', async () => {

src/components/form-radio/form-radio.js

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,23 @@
11
import { Vue } from '../../vue'
22
import { NAME_FORM_RADIO } from '../../constants/components'
33
import { looseEqual } from '../../utils/loose-equal'
4-
import { sortKeys } from '../../utils/object'
54
import { makePropsConfigurable } from '../../utils/props'
6-
import { formControlMixin, props as formControlProps } from '../../mixins/form-control'
75
import {
86
MODEL_EVENT_NAME,
97
formRadioCheckMixin,
108
props as formRadioCheckProps
119
} from '../../mixins/form-radio-check'
12-
import { formSizeMixin, props as formSizeProps } from '../../mixins/form-size'
13-
import { formStateMixin, props as formStateProps } from '../../mixins/form-state'
14-
import { idMixin, props as idProps } from '../../mixins/id'
1510

1611
// --- Props ---
1712

18-
export const props = makePropsConfigurable(
19-
sortKeys({
20-
...idProps,
21-
...formControlProps,
22-
...formRadioCheckProps,
23-
...formSizeProps,
24-
...formStateProps
25-
}),
26-
NAME_FORM_RADIO
27-
)
13+
export const props = makePropsConfigurable(formRadioCheckProps, NAME_FORM_RADIO)
2814

2915
// --- Main component ---
3016

3117
// @vue/component
3218
export const BFormRadio = /*#__PURE__*/ Vue.extend({
3319
name: NAME_FORM_RADIO,
34-
mixins: [
35-
idMixin,
36-
formRadioCheckMixin, // Includes shared render function
37-
formControlMixin,
38-
formSizeMixin,
39-
formStateMixin
40-
],
20+
mixins: [formRadioCheckMixin],
4121
inject: {
4222
bvGroup: {
4323
from: 'bvRadioGroup',

src/mixins/form-radio-check-group.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ export const formRadioCheckGroupMixin = Vue.extend({
132132
// We don't need to include these, since the input's will know they are inside here
133133
// form: this.form || null,
134134
// name: this.groupName,
135-
// required: Boolean(this.name && this.required)
135+
// required: Boolean(this.name && this.required),
136+
// state: this.state
136137
},
137138
attrs,
138139
key

yarn.lock

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,15 +1550,15 @@
15501550
dependencies:
15511551
vue-analytics "^5.22.1"
15521552

1553-
"@nuxtjs/pwa@^3.3.4":
1554-
version "3.3.4"
1555-
resolved "https://registry.yarnpkg.com/@nuxtjs/pwa/-/pwa-3.3.4.tgz#557a7a57bc3713bcc820bc88942069af263fd045"
1556-
integrity sha512-aDw9xnTIPdqknvgm5uOtuhcmMedtCy8HALQ4lSb30UqLQzY0z6yOyGSq+6ShybtDW2FjaBeyhs/ooEIP0XZZ9A==
1553+
"@nuxtjs/pwa@^3.3.5":
1554+
version "3.3.5"
1555+
resolved "https://registry.yarnpkg.com/@nuxtjs/pwa/-/pwa-3.3.5.tgz#db7c905536ebe8a464a347b6ae3215810642c044"
1556+
integrity sha512-8tTmW8DBspWxlJwTimOHTkwfkwPpL9wIcGmy75Gcmin+c9YtX2Ehxmhgt/TLFOC9XsLAqojqynw3/Agr/9OE1w==
15571557
dependencies:
15581558
clone-deep "^4.0.1"
15591559
defu "^3.2.2"
15601560
execa "^5.0.0"
1561-
fs-extra "^9.0.1"
1561+
fs-extra "^9.1.0"
15621562
hasha "^5.2.2"
15631563
jimp-compact "^0.16.1"
15641564
lodash.template "^4.5.0"
@@ -2767,12 +2767,12 @@ axios@^0.18.1:
27672767
follow-redirects "1.5.10"
27682768
is-buffer "^2.0.2"
27692769

2770-
axios@^0.19.0:
2771-
version "0.19.2"
2772-
resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz#3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27"
2773-
integrity sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==
2770+
axios@^0.21.1:
2771+
version "0.21.1"
2772+
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
2773+
integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
27742774
dependencies:
2775-
follow-redirects "1.5.10"
2775+
follow-redirects "^1.10.0"
27762776

27772777
babel-code-frame@^6.26.0:
27782778
version "6.26.0"
@@ -3290,12 +3290,12 @@ builtins@^1.0.3:
32903290
resolved "https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88"
32913291
integrity sha1-y5T662HIaWRR2zZTThQi+U8K7og=
32923292

3293-
bundlewatch@^0.3.1:
3294-
version "0.3.1"
3295-
resolved "https://registry.yarnpkg.com/bundlewatch/-/bundlewatch-0.3.1.tgz#1d367a9878c9306b5ec5f23cab2eb8178664f758"
3296-
integrity sha512-yVuOHljZCxRrDgujRn7GED+7Ms8G7hQJmP8vtQWIquDwDfocJH6RdRX42mqDWhMXGdsT3qhB1GYJ5q5zFZ0AEA==
3293+
bundlewatch@^0.3.2:
3294+
version "0.3.2"
3295+
resolved "https://registry.yarnpkg.com/bundlewatch/-/bundlewatch-0.3.2.tgz#b07c57347a790f436f8b59c12418618f5e938432"
3296+
integrity sha512-gqekMv+ph1vKjM2B6P7mk8HxNZ3ZLOU94Vo3eFqPgQ0COqDsYcrPwsmpczAwsPxOMY7ZpKCGUez7shbdttCDew==
32973297
dependencies:
3298-
axios "^0.19.0"
3298+
axios "^0.21.1"
32993299
bytes "^3.0.0"
33003300
chalk "^4.0.0"
33013301
ci-env "^1.14.0"
@@ -6183,6 +6183,11 @@ follow-redirects@1.5.10:
61836183
dependencies:
61846184
debug "=3.1.0"
61856185

6186+
follow-redirects@^1.10.0:
6187+
version "1.13.2"
6188+
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.2.tgz#dd73c8effc12728ba5cf4259d760ea5fb83e3147"
6189+
integrity sha512-6mPTgLxYm3r6Bkkg0vNM0HTjfGrOEtsfbhagQvbxDEsEkpNhw582upBaoRZylzen6krEmxXJgt9Ju6HiI4O7BA==
6190+
61866191
for-in@^1.0.2:
61876192
version "1.0.2"
61886193
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
@@ -6267,15 +6272,15 @@ fs-extra@^8.1.0:
62676272
jsonfile "^4.0.0"
62686273
universalify "^0.1.0"
62696274

6270-
fs-extra@^9.0.0, fs-extra@^9.0.1:
6271-
version "9.0.1"
6272-
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.0.1.tgz#910da0062437ba4c39fedd863f1675ccfefcb9fc"
6273-
integrity sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==
6275+
fs-extra@^9.0.0, fs-extra@^9.1.0:
6276+
version "9.1.0"
6277+
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d"
6278+
integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==
62746279
dependencies:
62756280
at-least-node "^1.0.0"
62766281
graceful-fs "^4.2.0"
62776282
jsonfile "^6.0.1"
6278-
universalify "^1.0.0"
6283+
universalify "^2.0.0"
62796284

62806285
fs-memo@^1.2.0:
62816286
version "1.2.0"
@@ -8950,10 +8955,10 @@ markdown-table@^2.0.0:
89508955
dependencies:
89518956
repeat-string "^1.0.0"
89528957

8953-
marked@^1.2.7:
8954-
version "1.2.7"
8955-
resolved "https://registry.yarnpkg.com/marked/-/marked-1.2.7.tgz#6e14b595581d2319cdcf033a24caaf41455a01fb"
8956-
integrity sha512-No11hFYcXr/zkBvL6qFmAp1z6BKY3zqLMHny/JN/ey+al7qwCM2+CMBL9BOgqMxZU36fz4cCWfn2poWIf7QRXA==
8958+
marked@^1.2.8:
8959+
version "1.2.8"
8960+
resolved "https://registry.yarnpkg.com/marked/-/marked-1.2.8.tgz#5008ece15cfa43e653e85845f3525af4beb6bdd4"
8961+
integrity sha512-lzmFjGnzWHkmbk85q/ILZjFoHHJIQGF+SxGEfIdGk/XhiTPhqGs37gbru6Kkd48diJnEyYwnG67nru0Z2gQtuQ==
89578962

89588963
md5.js@^1.3.4:
89598964
version "1.3.5"
@@ -13821,11 +13826,6 @@ universalify@^0.1.0:
1382113826
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
1382213827
integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==
1382313828

13824-
universalify@^1.0.0:
13825-
version "1.0.0"
13826-
resolved "https://registry.yarnpkg.com/universalify/-/universalify-1.0.0.tgz#b61a1da173e8435b2fe3c67d29b9adf8594bd16d"
13827-
integrity sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==
13828-
1382913829
universalify@^2.0.0:
1383013830
version "2.0.0"
1383113831
resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"

0 commit comments

Comments
 (0)