import { haveText, html, test } from '../utils'
test('can clone a component',
html`
click me
click me
`,
({ get }) => {
get('#original h1').click()
get('#original span').should(haveText('baz'))
get('#copy span').should(haveText(''))
get('button').click()
get('#copy span').should(haveText('baz'))
}
)
test('wont run init on clone',
html`
`,
({ get }) => {
get('#original span').should(haveText('1'))
get('#copy span').should(haveText(''))
get('button').click()
get('#copy span').should(haveText('1'))
}
)
test('wont register listeners on clone',
html`
inc
`,
({ get }) => {
get('#original span').should(haveText('1'))
get('#copy span').should(haveText(''))
get('button').click()
get('#copy span').should(haveText('1'))
get('#copy h1').click()
get('#copy span').should(haveText('1'))
}
)
test('wont register extra listeners on x-model on clone',
html`
`,
({ get }) => {
get('#original span').should(haveText(''))
get('#copy span').should(haveText(''))
get('button').click()
get('#copy span').should(haveText(''))
get('#copy input').click()
get('#copy span').should(haveText('1'))
}
)