Skip to content

Commit

Permalink
fix: widget name in documentation link for index (#4172)
Browse files Browse the repository at this point in the history
For technical reason we were not able to use `index` as widget name in
the docs, so we picked instead `index-widget`.

When you misuse a widget, we output an error message with a link to the
documentation generated from the name of the widget.

This commit handle the special case of the index widget.
  • Loading branch information
tkrugg committed Nov 26, 2019
1 parent 5a62df9 commit fe7e588
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/widgets/index/__tests__/index-test.ts
Expand Up @@ -97,7 +97,7 @@ describe('index', () => {
}).toThrowErrorMatchingInlineSnapshot(`
"The \`indexName\` option is required.
See documentation: https://www.algolia.com/doc/api-reference/widgets/index/js/"
See documentation: https://www.algolia.com/doc/api-reference/widgets/index-widget/js/"
`);
});

Expand All @@ -107,7 +107,7 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/index/js/"
}).toThrowErrorMatchingInlineSnapshot(`
"The \`indexName\` option is required.
See documentation: https://www.algolia.com/doc/api-reference/widgets/index/js/"
See documentation: https://www.algolia.com/doc/api-reference/widgets/index-widget/js/"
`);
});

Expand Down Expand Up @@ -169,7 +169,7 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/index/js/"
}).toThrowErrorMatchingInlineSnapshot(`
"The \`addWidgets\` method expects an array of widgets.
See documentation: https://www.algolia.com/doc/api-reference/widgets/index/js/"
See documentation: https://www.algolia.com/doc/api-reference/widgets/index-widget/js/"
`);
});

Expand All @@ -181,7 +181,7 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/index/js/"
}).toThrowErrorMatchingInlineSnapshot(`
"The widget definition expects a \`render\` and/or an \`init\` method.
See documentation: https://www.algolia.com/doc/api-reference/widgets/index/js/"
See documentation: https://www.algolia.com/doc/api-reference/widgets/index-widget/js/"
`);
});

Expand Down Expand Up @@ -366,7 +366,7 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/index/js/"
}).toThrowErrorMatchingInlineSnapshot(`
"The \`removeWidgets\` method expects an array of widgets.
See documentation: https://www.algolia.com/doc/api-reference/widgets/index/js/"
See documentation: https://www.algolia.com/doc/api-reference/widgets/index-widget/js/"
`);
});

Expand All @@ -378,7 +378,7 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/index/js/"
}).toThrowErrorMatchingInlineSnapshot(`
"The widget definition expects a \`dispose\` method.
See documentation: https://www.algolia.com/doc/api-reference/widgets/index/js/"
See documentation: https://www.algolia.com/doc/api-reference/widgets/index-widget/js/"
`);
});

Expand Down
2 changes: 1 addition & 1 deletion src/widgets/index/index.ts
Expand Up @@ -26,7 +26,7 @@ import {
} from '../../lib/utils';

const withUsage = createDocumentationMessageGenerator({
name: 'index',
name: 'index-widget',
});

type IndexProps = {
Expand Down

0 comments on commit fe7e588

Please sign in to comment.