Skip to content

Commit

Permalink
Merge pull request #28 from quicoto/tests
Browse files Browse the repository at this point in the history
fix: adds a test to cover deep nesting with same key
  • Loading branch information
quicoto authored Aug 18, 2022
2 parents a11ac04 + f10448c commit 26137d1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,30 @@ describe(`twoWayDataBinding`, () => {
expect($element).toHaveTextContent(`Thor`);
});

it(`Uses a deep object with same key as dataModel`, () => {
const {
container,
bindName
} = render(
`<span data-bind="user.firstName.user"></span>`,
`data-bind`
);

twoWayDataBinding({
$context: container,
dataModel: {
user: {
firstName: {
user: `Thor`
}
}
}
});

const $element = bindName(`user.firstName.user`);
expect($element).toHaveTextContent(`Thor`);
});

it(`Uses an empty object as dataModel`, () => {
const {
container,
Expand Down

0 comments on commit 26137d1

Please sign in to comment.