forked from KatChaotic/sveltedoc-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
0b25055
commit ec5de3d
Showing
9 changed files
with
137 additions
and
3 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
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
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,4 @@ | ||
<script> | ||
/** The nested component. */ | ||
import Nested from './components.nested.svelte'; | ||
</script> |
3 changes: 3 additions & 0 deletions
3
test/svelte3/integration/components/components.importStar.svelte
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,3 @@ | ||
<script> | ||
import * as Imported from './components.importable.js'; | ||
</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,2 @@ | ||
export let X = 1; | ||
export let y = 2; |
3 changes: 3 additions & 0 deletions
3
test/svelte3/integration/components/components.lowercase.svelte
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,3 @@ | ||
<script> | ||
import nested from './components.nested.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,4 @@ | ||
<script> | ||
let width = 1; | ||
let height = 2; | ||
</script> |
3 changes: 3 additions & 0 deletions
3
test/svelte3/integration/components/components.notdefault.svelte
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,3 @@ | ||
<script> | ||
import { X } from './components.importable.js'; | ||
</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,81 @@ | ||
const path = require('path'); | ||
const chai = require('chai'); | ||
const expect = chai.expect; | ||
|
||
const parser = require('../../../../index'); | ||
|
||
describe('SvelteDoc v3 - Components', () => { | ||
it('Import with upper case default should be parsed as component', (done) => { | ||
parser.parse({ | ||
version: 3, | ||
filename: path.resolve(__dirname, 'components.import.svelte'), | ||
features: ['components'], | ||
ignoredVisibilities: [] | ||
}).then((doc) => { | ||
expect(doc, 'Document should be provided').to.exist; | ||
expect(doc.components, 'Document components should be parsed').to.exist; | ||
|
||
expect(doc.components.length).to.equal(1); | ||
const component = doc.components[0]; | ||
expect(component.name).to.equal('Nested'); | ||
expect(component.value).to.equal('./components.nested.svelte'); | ||
expect(component.visibility).to.equal('private'); | ||
|
||
expect(component.description).to.equal('The nested component.'); | ||
done(); | ||
}).catch(e => { | ||
done(e); | ||
}); | ||
}); | ||
|
||
it('Import with upper case not default should not be parsed as component', (done) => { | ||
parser.parse({ | ||
version: 3, | ||
filename: path.resolve(__dirname, 'components.notdefault.svelte'), | ||
features: ['components'], | ||
ignoredVisibilities: [] | ||
}).then((doc) => { | ||
expect(doc, 'Document should be provided').to.exist; | ||
expect(doc.components, 'Document components should be parsed').to.exist; | ||
|
||
expect(doc.components.length).to.equal(0); | ||
done(); | ||
}).catch(e => { | ||
done(e); | ||
}); | ||
}); | ||
|
||
it('Import with lowercase case default should not be parsed as component', (done) => { | ||
parser.parse({ | ||
version: 3, | ||
filename: path.resolve(__dirname, 'components.lowercase.svelte'), | ||
features: ['components'], | ||
ignoredVisibilities: [] | ||
}).then((doc) => { | ||
expect(doc, 'Document should be provided').to.exist; | ||
expect(doc.components, 'Document components should be parsed').to.exist; | ||
|
||
expect(doc.components.length).to.equal(0); | ||
done(); | ||
}).catch(e => { | ||
done(e); | ||
}); | ||
}); | ||
|
||
it('Import with start and alias should not be parsed as component', (done) => { | ||
parser.parse({ | ||
version: 3, | ||
filename: path.resolve(__dirname, 'components.importStar.svelte'), | ||
features: ['components'], | ||
ignoredVisibilities: [] | ||
}).then((doc) => { | ||
expect(doc, 'Document should be provided').to.exist; | ||
expect(doc.components, 'Document components should be parsed').to.exist; | ||
|
||
expect(doc.components.length).to.equal(0); | ||
done(); | ||
}).catch(e => { | ||
done(e); | ||
}); | ||
}); | ||
}); |