bitovi / bitovi/documentjs

Make examples or demo's testable and demoed in JSBin

Open
#87 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
598
Forks
371
PR merge metrics
No merged PRs in 30d

Description

I'd like to make it possible to:
- [ ] - create a demo who shows up in JSBin - [related issue](https://github.com/jsbin/jsbin/issues/2200)
- [ ] - create a demo whose code is testable by some form of CI

Writing an example like:

```
@example

This is some text describing the example code.

@src html

Hello World


@src js
import $ from 'jquery'
$("h1").fadeIn();

@src css
h1{ display: none}

@src test
import js from 'js'
import QUnit from 'steal-qunit'
QUnit.module("hello-world")
QUnit.test("fadeIn", function(){

})
```

Issues:
## "runtime" issues
- JSBin will run "src" code right away.
- But while testing, the "src" code will mostly need to be executed within the extra test.

src test could be written like:

```
@src test
import QUnit from 'steal-qunit'
QUnit.module("hello-world");
QUnit.asyncTest("fadeIn", function(){
Promise.all([
'html!add-html-to-qunit-fixture', 'js', 'css!css'
]).then(function(){
QUnit.equal( $("h1").css("opacity"), 1);
start();
})
})
```

Issues:
- [ ] the html needs to be added to qunit-fixture and the CSS needs to be loaded before JS runs.
- [ ] the html has steal in it

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.