scittle

craftybones 2022-11-04T02:16:28.620279Z

adapt-react-class is not bundled as a part of scittle. I went through sci.configs and it doesn't seem to be there. Is there any specific reason? I would like to use a CSSTransitionGroup component that is already bundled. I might be able to do it without adapting the react class

borkdude 2022-11-04T07:01:22.715869Z

PR welcome

borkdude 2022-11-04T07:01:55.149389Z

I think @jayzawrotny also mentioned some missing things a while back

2022-11-04T07:05:00.547299Z

:> is though

👍 1
2022-11-04T07:10:48.075579Z

@srijayanth [:> CSSTransitionGroup {} ...] should do it

craftybones 2022-11-04T15:18:24.284189Z

Excellent! Thank you very much!

borkdude 2022-11-04T15:38:03.295669Z

Still a PR would be in order for the next person who is going to hit this :)

2022-11-04T15:38:55.528839Z

Fair enough. Might have some time today

craftybones 2022-11-06T15:35:29.346219Z

@borkdude - I am trying to run the tests for sci.configs but there are a bunch of issues:

1. The sci dependency in deps.edn is for the version SHA 95d04fc356adf50a6e36cfa4f5a0540300f326f3. This version doesn't have a required namespace (sci.ctx-store).

2. Using the latest SHA still fails because ctx isn't explicitly set in the tests

3. Explicitly setting the ctx by using sci.ctx-store/reset-ctx runs the tests.
I want to raise a PR for including adapt-react-class . Should I fix this and issue it as a part of the same PR? It will require an updation of the deps.edn to use the latest sci or at least a version that includes ctx-store.

borkdude 2022-11-06T15:38:52.788449Z

yes to all

borkdude 2022-11-06T15:38:54.784829Z

thanks!

2022-11-06T19:04:32.931889Z

https://github.com/babashka/sci.configs are there tests there for the reagent functions?

borkdude 2022-11-06T19:05:22.419269Z

Not really. I need to add a test runner, I'll do this later today

borkdude 2022-11-06T20:20:37.909439Z

Added the test runner + reagent test

👍 1
🙏 1
craftybones 2022-11-07T01:32:55.500149Z

How would I write a test that uses a js class? I’d have to somehow give the ctx a way to know what my symbol means. But this is sort of a fake test since I’ll entirely be in cljs land whereas the original class will be some sort of js/Foo .

craftybones 2022-11-07T01:34:06.433389Z

I mean, I can choose not to have the test since all we’re doing is including one more var, adapt-react-class … maybe the test is simply that the var exists

2022-11-07T01:36:03.709749Z

Could write a simplified React class in a JS file, then import it into the test file, render it to a string, and test the markup

2022-11-07T01:37:03.580889Z

My instinct would either be to not include a test since it's just the long way of doing [:> MyClass] or doing a full test like described above. I feel like having a test that only proves the var exists may lead to false positives

craftybones 2022-11-07T01:43:03.844349Z

Yeah 😐

craftybones 2022-11-07T01:43:15.220879Z

I won’t include the test.

craftybones 2022-11-07T01:43:45.775459Z

It is a lot of work and tests somebody else’s code, not ours 😄

2022-11-07T01:44:28.237109Z

export default class TestView extends React.Component {
  render () {
   return React.createElement('div', "Content")
  }
}
That should do it, saved as a fixture

craftybones 2022-11-07T01:45:49.075319Z

Would have to import this as well.

2022-11-07T01:47:46.193679Z

(require ["./test/fixtures/TestView.js" :as TestView])

craftybones 2022-11-07T02:24:08.847079Z

The test runner doesn’t pickup the fixture. I am not sure how the test runner loads js dependencies.

2022-11-07T02:24:39.236799Z

If you want to push up what you have I could give it a shot

craftybones 2022-11-07T02:25:28.800079Z

Right now, I’m just playing around to see how to get a test going with an external js lib. One way is to use package.json. I’ll spend some more time with it. I want to understand this better

2022-11-07T02:25:48.358029Z

This is the sci.configs repo?

craftybones 2022-11-07T02:26:06.563679Z

Yeah.

2022-11-07T02:33:23.984849Z

According to the cljs test runner docs, the tests are ran through node. What does (println (js/process.cwd)) display in the test file?

2022-11-07T02:34:11.332519Z

Worst case could do (def TestView (js/require "../test/fixtures/TestView.js"))

2022-11-07T02:34:55.350559Z

The correct path will depend on the current working directory of the test script though

2022-11-07T02:40:10.897579Z

If that still doesn't work, could ditch the js file and use the reagent create-react-class API https://cljdoc.org/d/reagent/reagent/1.1.1/api/reagent.core#create-class in the test file. The js version is more realistic though

craftybones 2022-11-04T02:22:10.271679Z

If this is an oversight, I can simply provide a PR to sci.configs