Skip to content

Commit

Permalink
Add assertion for component extraction to assert correct registration
Browse files Browse the repository at this point in the history
  • Loading branch information
DingoEatingFuzz committed Jul 19, 2023
1 parent d24cfd0 commit 06e9c98
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
order: 1
---

# Demo of DocfyLink component

This is a cool feature.

[Link from a demo](../docfy-output.md)

```hbs template
<div data-test-id="demo-1">
This is my Demo:
<DocfyLink @to={{this.url}}>My Link</DocfyLink>
</div>
<div data-test-id="demo-1-js-data">{{this.url}}</div>
```

```js component
import Component from '@glimmer/component';

export default class MyDemo extends Component {
url = '/docs/ember/';
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
category: ember
subcategory: components
---

# Docfy With Hyphenated Number 2

Testing doc pages with numbers in their name and how that corresponds with
automatic component registration.
2 changes: 1 addition & 1 deletion packages/ember/tests/fastboot/docs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module('FastBoot | docs', function (hooks) {
assert
.dom('[data-test-id="docs-nav"]')
.hasText(
'Welcome to Docfy Introduction Installation Overview @docfy/core Overview Helpers genereateFlatOutput genereateNestedOutput @docfy/ember Working with Ember Installation Components Docfy Link Component Docfy Output Component Plugins Manual Demo Insertion'
'Welcome to Docfy Introduction Installation Overview @docfy/core Overview Helpers genereateFlatOutput genereateNestedOutput @docfy/ember Working with Ember Installation Components Docfy Link Component Docfy Output Component Docfy With Hyphenated Number 2 Plugins Manual Demo Insertion'
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module('Integration | Component | DocfyOutput', function (hooks) {
assert
.dom('[data-test-id="flat-urls"]')
.hasText(
'/docs/ /docs/introduction /docs/installation /docs/overview /docs/core/overview /docs/core/helpers/genereate-flat-output /docs/core/helpers/genereate-nested-output /docs/ember/ /docs/ember/installation /docs/ember/components/docfy-link /docs/ember/components/docfy-output /docs/ember/plugins/manual-demo-insertion'
'/docs/ /docs/introduction /docs/installation /docs/overview /docs/core/overview /docs/core/helpers/genereate-flat-output /docs/core/helpers/genereate-nested-output /docs/ember/ /docs/ember/installation /docs/ember/components/docfy-link /docs/ember/components/docfy-output /docs/ember/components/docfy-with-hyphenated-number-2 /docs/ember/plugins/manual-demo-insertion'
);
});

Expand Down
2 changes: 2 additions & 0 deletions packages/ember/tests/unit/demo-component-generation-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ module('Unit | Demo component generation', function (hooks) {
// dummy/docs/packages/ember/components/docfy-link-demo/{demo-file}.md
has('packages-ember-components-docfy-link-demo1');
has('packages-ember-components-docfy-link-demo2');
// dummy/docs/packages/ember/components/docfy-with-hyphenated-number-2/{demo-file}.md
has('packages-ember-components-docfy-with-hyphenated-number-2-demo1');
// where do these come from?
has('preview-ember');
has('preview-ember1');
Expand Down
5 changes: 4 additions & 1 deletion packages/ember/tests/unit/services/docfy-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ module('Unit | Service | docfy', function (hooks) {
.stub(routerService, 'currentURL')
.get(() => '/docs/ember/plugins/manual-demo-insertion');

assert.equal(service.previousPage()?.title, 'Docfy Output Component');
assert.equal(
service.previousPage()?.title,
'Docfy With Hyphenated Number 2'
);
assert.equal(service.nextPage()?.title, undefined);
});

Expand Down

0 comments on commit 06e9c98

Please sign in to comment.