Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Backing class JavaScript file not working if path contains underscore #70

Open
didoo opened this issue Oct 17, 2022 · 0 comments
Open

Comments

@didoo
Copy link

didoo commented Oct 17, 2022

Probably a bug. Did some experiments to understand why in some cases the backing class JavaScript file associated with a Markdown file was not picked up, and I've found a strange behaviour. If the path of the file (be it a parent folder, or the file itself) contains an underscore (_) then the JS file is ignored.

To test this I have forked this repo, and simply added a bunch of test files (direct copies of the custom-button.js + custom-button.md demo files) and checked what happened in different cases.

You can test yourself using this branch in my fork: https://github.com/didoo/field-guide-testing/tree/backing-class-path-underscore-bug/docs

Here's what I've found:

With a simple file name and a parent folder that doesn't contain an underscore - It works ✅

  • markdown file: test-file.md
  • javascript file: test-file.js
  • parent folder: 01-testing-normal-folder

screenshot_1879

You can see that it works by the `0` zero visible after the `Count` text (and clicking the button increases the value).

Same file but with an underscore in the name - It doesn't work ❌

  • markdown file: test-file_with_underscore.md
  • javascript file: test-file_with_underscore.js
  • parent folder: 01-testing-normal-folder

screenshot_1880

You can see that it works by the lack of`0` zero after the `Count` text and clicking the button triggers this error:

screenshot_1882

Same file with a 0x-- prefix - It works ✅

  • markdown file: 01--test-file-with-number-prefix.md
  • javascript file: 01--test-file-with-number-prefix.js
  • parent folder: 01-testing-normal-folder

screenshot_1874

Same file with a 0x_ prefix in both the Markdown and the JS files - It doesn't work ❌

  • markdown file: 02_test-file-with-number-prefix-and-underscore.md
  • javascript file: 02_test-file-with-number-prefix-and-underscore.js
  • parent folder: 01-testing-normal-folder

screenshot_1877

Same file with a 0x_ prefix in the Markdown, but a normal dash in the JS file - Strangely, it works 🤔

  • markdown file: 03_test-file-with-number-prefix-and-mixed.md
  • javascript file: 03-test-file-with-number-prefix-and-mixed.js
  • parent folder: 01-testing-normal-folder

screenshot_1878

Same file with a parent folder that contains an underscore - It doesn't work ❌

  • markdown file: test-file.md
  • javascript file: test-file.js
  • parent folder: 02_testing-folder_with_underscore

screenshot_1873

didoo added a commit to hashicorp/design-system that referenced this issue Oct 17, 2022
…(double dash) instead of `_` (underscore) in file names to avoid bug in Field Guide

empress/field-guide#70
didoo added a commit to hashicorp/design-system that referenced this issue Oct 17, 2022
… to Markdown to use `--` (double dash) instead of `_` (underscore) in file names to avoid bug in Field Guide

empress/field-guide#70
didoo added a commit to hashicorp/design-system that referenced this issue Oct 17, 2022
… to Markdown to use `--` (double dash) instead of `_` (underscore) in file names to avoid bug in Field Guide

empress/field-guide#70
didoo added a commit to hashicorp/design-system that referenced this issue Oct 17, 2022
… to Markdown to use `--` (double dash) instead of `_` (underscore) in file names to avoid bug in Field Guide

empress/field-guide#70
didoo added a commit to hashicorp/design-system that referenced this issue Oct 18, 2022
… to Markdown to use `--` (double dash) instead of `_` (underscore) in file names to avoid bug in Field Guide

empress/field-guide#70
didoo added a commit to hashicorp/design-system that referenced this issue Oct 18, 2022
… to Markdown to use `--` (double dash) instead of `_` (underscore) in file names to avoid bug in Field Guide

empress/field-guide#70
didoo added a commit to hashicorp/design-system that referenced this issue Oct 18, 2022
… to Markdown to use `--` (double dash) instead of `_` (underscore) in file names to avoid bug in Field Guide

empress/field-guide#70
didoo added a commit to hashicorp/design-system that referenced this issue Oct 18, 2022
… to Markdown to use `--` (double dash) instead of `_` (underscore) in file names to avoid bug in Field Guide

empress/field-guide#70
didoo added a commit to hashicorp/design-system that referenced this issue Oct 22, 2022
… to Markdown to use `--` (double dash) instead of `_` (underscore) in file names to avoid bug in Field Guide

empress/field-guide#70
didoo added a commit to hashicorp/design-system that referenced this issue Oct 24, 2022
… to Markdown to use `--` (double dash) instead of `_` (underscore) in file names to avoid bug in Field Guide

empress/field-guide#70
didoo added a commit to hashicorp/design-system that referenced this issue Oct 24, 2022
… to Markdown to use `--` (double dash) instead of `_` (underscore) in file names to avoid bug in Field Guide

empress/field-guide#70
didoo added a commit to hashicorp/design-system that referenced this issue Oct 25, 2022
… to Markdown to use `--` (double dash) instead of `_` (underscore) in file names to avoid bug in Field Guide

empress/field-guide#70
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant