-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<ShopingCart bind:totalCost={totalCost} /> | ||
|
||
<script> | ||
import ShopingCart from './ShopingCart.svelte'; | ||
let totalCost; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<ShopingCart bind:totalCost={cost} /> | ||
|
||
<script> | ||
import ShopingCart from './ShopingCart.svelte'; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<ShopingCart bind:totalCost /> | ||
|
||
<script> | ||
import ShopingCart from './ShopingCart.svelte'; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
const path = require('path'); | ||
const chai = require('chai'); | ||
const expect = chai.expect; | ||
|
||
const parser = require('../../../../index'); | ||
|
||
describe('SvelteDoc v3 - Bind', () => { | ||
it('Bind simple definition should be parsed', (done) => { | ||
parser.parse({ | ||
version: 3, | ||
filename: path.resolve(__dirname, 'bind.simple.svelte'), | ||
features: ['data'], | ||
ignoredVisibilities: [] | ||
}).then((doc) => { | ||
expect(doc, 'Document should be provided').to.exist; | ||
expect(doc.data, 'Document data should be parsed').to.exist; | ||
|
||
expect(doc.data.length).to.equal(1); | ||
const item = doc.data[0]; | ||
|
||
expect(item, 'Bind item should be a valid entity').to.exist; | ||
expect(item.name).to.equal('totalCost'); | ||
expect(item.visibility).to.equal('private'); | ||
expect(item.bind, 'Bind information should be presented').to.exist; | ||
expect(item.bind.source).to.equal('ShopingCart'); | ||
expect(item.bind.property).to.equal('totalCost'); | ||
|
||
done(); | ||
}).catch(e => { | ||
done(e); | ||
}); | ||
}); | ||
|
||
it('Bind named definition should be parsed', (done) => { | ||
parser.parse({ | ||
version: 3, | ||
filename: path.resolve(__dirname, 'bind.named.svelte'), | ||
features: ['data'], | ||
ignoredVisibilities: [] | ||
}).then((doc) => { | ||
expect(doc, 'Document should be provided').to.exist; | ||
expect(doc.data, 'Document data should be parsed').to.exist; | ||
|
||
expect(doc.data.length).to.equal(1); | ||
const item = doc.data[0]; | ||
|
||
expect(item, 'Bind item should be a valid entity').to.exist; | ||
expect(item.name).to.equal('cost'); | ||
expect(item.visibility).to.equal('private'); | ||
expect(item.bind, 'Bind information should be presented').to.exist; | ||
expect(item.bind.source).to.equal('ShopingCart'); | ||
expect(item.bind.property).to.equal('totalCost'); | ||
|
||
done(); | ||
}).catch(e => { | ||
done(e); | ||
}); | ||
}); | ||
|
||
it('Bind declared definition should be parsed', (done) => { | ||
parser.parse({ | ||
version: 3, | ||
filename: path.resolve(__dirname, 'bind.declared.svelte'), | ||
features: ['data'], | ||
ignoredVisibilities: [] | ||
}).then((doc) => { | ||
expect(doc, 'Document should be provided').to.exist; | ||
expect(doc.data, 'Document data should be parsed').to.exist; | ||
|
||
expect(doc.data.length).to.equal(1); | ||
const item = doc.data[0]; | ||
|
||
expect(item, 'Bind item should be a valid entity').to.exist; | ||
expect(item.name).to.equal('totalCost'); | ||
expect(item.visibility).to.equal('private'); | ||
expect(item.bind, 'Bind information should be presented').to.exist; | ||
expect(item.bind.source).to.equal('ShopingCart'); | ||
expect(item.bind.property).to.equal('totalCost'); | ||
|
||
done(); | ||
}).catch(e => { | ||
done(e); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters