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

Use the testcase widget for the $reveal widget examples #8406

Conversation

btheado
Copy link
Contributor

@btheado btheado commented Jul 21, 2024

Translate the $reveal examples to use the $testcase widget.

Directly used the $testcase widget rather than test case tiddlers so the user can interactively click the buttons to see the behavior.

Copy link

vercel bot commented Jul 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
tiddlywiki5 ✅ Ready (Inspect) Visit Preview Jul 21, 2024 6:39pm

@Jermolene
Copy link
Member

Thanks @btheado – sorry if I'm missing something obvious, but why can't these examples use separate testcase compound tiddlers?

@btheado
Copy link
Contributor Author

btheado commented Jul 21, 2024

I was thinking the testcase compound tiddlers required the expected results which don't seem to mean much for interactive examples. It would only show that the initial rendering is correct, but not actually verify the intended interactive behavior. Maybe I need to check this assumption.

Compare to this pending PR where I do use testcase tiddlers: #8376

@Jermolene
Copy link
Member

Hi @btheado if the "ExpectedResults" tiddler is omitted then the testcase widget will not perform the test result checks. However, we might need to check in case the jasmine runner objects

@btheado
Copy link
Contributor Author

btheado commented Jul 21, 2024

OK, thanks. I'll play around with these examples as testcase tiddlers and see what happens.

@btheado
Copy link
Contributor Author

btheado commented Jul 21, 2024

Ok, I misremembered. It wasn't that the Expected Results were required is was that the view template didn't activate unless one of the $:/tags/wiki-test-spec tags were present. It didn't make sense to me to add that tag when no automatic test verification was taking place.

If you prefer to use the $:/tags/wiki-test-spec for these cases, that's fine with me. I admit it is nicer to have the examples factored out into separate tiddlers rather than inline, as that makes them reusable.

I didn't check yet how the jasmine runner behaves, but worst case, such tiddlers don't need to go into the tiddlers/testcases subdirectory. That way jasmine won't even see them.

btheado added 2 commits July 21, 2024 14:07
These examples are intended to be interactive and the expect results
only test the initial rendering. Still that seems like useful verification
@btheado
Copy link
Contributor Author

btheado commented Jul 21, 2024

I converted to testcase tiddlers. The jasmine runner treated the tests without ExpectedResult as passing tests and it worked fine. However, I figured it wouldn't hurt to add ExpectedResult of at least the initial rendering and so I did.

@btheado
Copy link
Contributor Author

btheado commented Jul 21, 2024

One point of friction with test case tiddlers is that editing via node.js causes the .tid extension to be removed and an extra .meta file to be created.

I suppose that is due to (from Customising Tiddler File Naming):

The default file extension of .tid is used for tiddlers that are missing the type field, or for tiddlers of type "text/vnd.tiddlywiki". Tidders of other types are saved according to their MIME types (defined at boot startup).

I haven't yet figured out how to change that for text/vnd.tiddlywiki-multiple.

@btheado
Copy link
Contributor Author

btheado commented Jul 21, 2024

I haven't yet figured out how to change that for text/vnd.tiddlywiki-multiple.

It worked to create a tiddler $:/config/FileSystemExtensions with this content:

[type[text/vnd.tiddlywiki-multiple]then[.tid]]

@Jermolene
Copy link
Member

It worked to create a tiddler $:/config/FileSystemExtensions with this content:

Thank you @btheado I think that would be worth another PR to explore solutions for this. We can't ship $:/config/FileSystemExtensions as part of the core because it will be overwritten by any user settings.

@Jermolene Jermolene merged commit adfb69a into TiddlyWiki:tiddlywiki-com Jul 22, 2024
4 checks passed
tsukasa-au pushed a commit to tsukasa-au/TiddlyWiki5 that referenced this pull request Aug 3, 2024
)

* Use the testcase widget for the $reveal widget examples

* Convert $reveal testcase widget examples into testcase tiddlers

* Add expected results to $reveal test case tiddlers

These examples are intended to be interactive and the expect results
only test the initial rendering. Still that seems like useful verification
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

Successfully merging this pull request may close these issues.

2 participants