-
Notifications
You must be signed in to change notification settings - Fork 73
Update theme checks for modern practices #1168
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess at runtime we still aren't sure if the this renders an unclosed html 🤔 But i guess we can't do anything about that.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know 😢, this is the downside of this |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1310,6 +1310,75 @@ describe('Module: ValidBlockTarget', () => { | |
| expect(offenses[0].uri).to.equal(`file:///${path}/slideshow.liquid`); | ||
| }); | ||
|
|
||
| it(`should not report errors for local blocks in presets when no root-level blocks array exists (${path} bucket)`, async () => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this valid? Like does it render if we actually run
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh like if the block files are empty?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would complain that the files are empty but it shouldn't have any impact on the test for this. I'll double check though
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I couldn't quite figure out what you were getting at here so feel free to poke me and I'll do a follow up |
||
| const theme: MockTheme = { | ||
| 'blocks/_card.liquid': ` | ||
| {% schema %} | ||
| { | ||
| "name": "Card", | ||
| "blocks": [ | ||
| { "type": "_title" }, | ||
| { "type": "_image" } | ||
| ] | ||
| } | ||
| {% endschema %} | ||
| `, | ||
| 'blocks/_title.liquid': '', | ||
| 'blocks/_image.liquid': '', | ||
| [`${path}/cards.liquid`]: ` | ||
| {% schema %} | ||
| { | ||
| "name": "Cards", | ||
| "presets": [ | ||
| { | ||
| "name": "Default", | ||
| "blocks": { | ||
| "card-1": { | ||
| "type": "_card", | ||
| "blocks": { | ||
| "title-1": { "type": "_title" }, | ||
| "image-1": { "type": "_image" } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| {% endschema %} | ||
| `, | ||
| }; | ||
|
|
||
| const offenses = await check(theme, [ValidBlockTarget]); | ||
| expect(offenses).to.be.empty; | ||
| }); | ||
|
|
||
| it(`should still report errors for local blocks in presets when root-level blocks array contains only @app (${path} bucket)`, async () => { | ||
| const theme: MockTheme = { | ||
| 'blocks/_card.liquid': '', | ||
| [`${path}/cards.liquid`]: ` | ||
| {% schema %} | ||
| { | ||
| "name": "Cards", | ||
| "blocks": [ | ||
| { "type": "@app" } | ||
| ], | ||
| "presets": [ | ||
| { | ||
| "name": "Default", | ||
| "blocks": { | ||
| "card-1": { "type": "_card" } | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| {% endschema %} | ||
| `, | ||
| }; | ||
|
|
||
| const offenses = await check(theme, [ValidBlockTarget]); | ||
| expect(offenses).not.to.be.empty; | ||
| }); | ||
|
|
||
| it('should not crash or timeout with cyclical nested block relationships', async () => { | ||
| const theme: MockTheme = { | ||
| 'blocks/block-b.liquid': ` | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.