Set incoming props as variable names rather than values in test rendering to allow props to be properly passed to component under test
This commit is contained in:
parent
fd6ad924d9
commit
5234677ad3
@ -33,10 +33,13 @@ const WrapperComponent = {
|
||||
name: 'WrapperComponent',
|
||||
components: { checkboxinput },
|
||||
template: testTemplate,
|
||||
props: {
|
||||
initialChecked: Boolean,
|
||||
},
|
||||
data: function () {
|
||||
return {
|
||||
name: 'testCheck',
|
||||
initialChecked: true
|
||||
initialchecked: this.initialChecked
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -50,7 +53,7 @@ describe('CheckboxInput Renders Correctly', () => {
|
||||
}
|
||||
})
|
||||
|
||||
wrapper.vm.$children[0].$data.isChecked = true
|
||||
// wrapper.vm.$children[0].$data.isChecked = true
|
||||
|
||||
expect(wrapper.find('.usa-input input').element.checked).toBe(true)
|
||||
})
|
||||
|
@ -2,14 +2,14 @@
|
||||
name='testVal'
|
||||
inline-template
|
||||
key='testVal'
|
||||
v-bind:initial-checked='false'
|
||||
v-bind:initial-checked='initialchecked'
|
||||
>
|
||||
<div>
|
||||
<div class='usa-input '>
|
||||
|
||||
<fieldset data-ally-disabled="true" v-on:change="onInput" class="usa-input__choices ">
|
||||
<legend>
|
||||
<input id="testVal" name="testVal" type="checkbox" v-model="isChecked" value="y">
|
||||
<input checked id="testVal" name="testVal" type="checkbox" v-model="isChecked" value="initialchecked">
|
||||
<label for="testVal">Hooray!</label>
|
||||
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
from wtforms.widgets import CheckboxInput
|
||||
from wtforms.fields import BooleanField
|
||||
from wtforms.fields import StringField
|
||||
from wtforms import Form
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/components'))
|
||||
|
||||
checkbox_template = env.get_template('checkbox_input.html')
|
||||
|
||||
field = BooleanField(
|
||||
field = StringField(
|
||||
label="Hooray!",
|
||||
default=False,
|
||||
default="initialchecked",
|
||||
widget=CheckboxInput()
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user