model-select.spec.ts — vue Source File
Architecture documentation for model-select.spec.ts, a typescript file in the vue codebase. 2 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR eacf6ea7_715f_9cb7_7d87_252baca11c87["model-select.spec.ts"] db9e7bef_009d_3918_6e7d_543a36a38d75["vue"] eacf6ea7_715f_9cb7_7d87_252baca11c87 --> db9e7bef_009d_3918_6e7d_543a36a38d75 09aa5370_2caa_6b33_3f44_6ac5211bd11b["util"] eacf6ea7_715f_9cb7_7d87_252baca11c87 --> 09aa5370_2caa_6b33_3f44_6ac5211bd11b style eacf6ea7_715f_9cb7_7d87_252baca11c87 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import Vue from 'vue'
import { looseEqual } from 'shared/util'
// Android 4.4 Chrome 30 has the bug that a multi-select option cannot be
// deselected by setting its "selected" prop via JavaScript.
function hasMultiSelectBug() {
const s = document.createElement('select')
s.setAttribute('multiple', '')
const o = document.createElement('option')
s.appendChild(o)
o.selected = true
o.selected = false
return o.selected !== false
}
/**
* setting <select>'s value in IE9 doesn't work
* we have to manually loop through the options
*/
function updateSelect(el, value) {
const options = el.options
let i = options.length
while (i--) {
if (looseEqual(getValue(options[i]), value)) {
options[i].selected = true
break
}
}
}
function getValue(option) {
return '_value' in option ? option._value : option.value || option.text
}
describe('Directive v-model select', () => {
it('should work', done => {
const vm = new Vue({
data: {
test: 'b'
},
template:
'<select v-model="test">' +
'<option>a</option>' +
'<option>b</option>' +
'<option>c</option>' +
'</select>'
}).$mount()
document.body.appendChild(vm.$el)
expect(vm.test).toBe('b')
expect(vm.$el.value).toBe('b')
expect(vm.$el.childNodes[1].selected).toBe(true)
vm.test = 'c'
waitForUpdate(function () {
expect(vm.$el.value).toBe('c')
expect(vm.$el.childNodes[2].selected).toBe(true)
updateSelect(vm.$el, 'a')
triggerEvent(vm.$el, 'change')
expect(vm.test).toBe('a')
}).then(done)
})
// ... (564 more lines)
Domain
Subdomains
Dependencies
- util
- vue
Source
Frequently Asked Questions
What does model-select.spec.ts do?
model-select.spec.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain, Instance subdomain.
What functions are defined in model-select.spec.ts?
model-select.spec.ts defines 3 function(s): getValue, hasMultiSelectBug, updateSelect.
What does model-select.spec.ts depend on?
model-select.spec.ts imports 2 module(s): util, vue.
Where is model-select.spec.ts in the architecture?
model-select.spec.ts is located at test/unit/features/directives/model-select.spec.ts (domain: VueCore, subdomain: Instance, directory: test/unit/features/directives).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free