Commit graph

415 commits

Author SHA1 Message Date
Christian Natis
a3410b8f3e Fixed syntax error in example 2015-11-12 10:56:46 -05:00
impinball
12b8f044f1 Convert tests to Mocha/Chai/Sinon and lint them.
Details:

1. All tests now live in `test`. All test dependencies that aren't from npm live
   in `test-deps`.

2. The QUnit tests are gone, as well as their dependencies. Half of them
   duplicated existing tests, and some of them depended on the real DOM to
   properly test.

3. All tests are now using Mocha to run the tests, Chai for assertions, and
   Sinon and Sinon Chai for testing some callbacks.

4. Tests are run through mocha-phantomjs. If you want to run just the tests,
   run `grunt mocha_phantomjs` or fire up a server in the root and open
   `http://localhost:<port>/test/index.html`, e.g. `python3 -m http.server`.

5. The linter I chose is ESLint. It is relatively easy to configure, but with a
   lot of flexibility. The rules I chose mostly were in tune to the style the
   project was already using. I'm not including a style guide in this commit,
   but one will likely come. You can check out the `.eslintrc` in the root and
   in `test/` for the two configs. The `.eslintignore` includes a TODO for
   `mithril.js` itself targeted at me, in the root.

Other info:

- As a drive-by fix, I fixed line endings on a few of the files.

- I also took care of a few other files and linted them as I went:

  - `Gruntfile.js`
  - `test/input-cursor.html` (was in `tests/`)
  - `test/svg.html` (was in `tests/`)
  - `docs/layout/tools/template-converter.html`
  - `docs/layout/tools/template-converter.js`

  I didn't test the template converter after linting it, because it needs
  further scrutiny to ensure it works with the latest version of Mithril. I
  know the API has changed a little, which is why I want to be sure.

- I simplified the `.travis.yml` file because none of the tests are run directly
  through Node anymore. They are always run in a browser of some kind.

Hopefully, this turned out all right...
2015-10-31 11:07:22 -04:00
Leo Horie
80f43c260b fix file size in docs 2015-09-28 22:26:41 -04:00
Leo Horie
8fa84c33f8 Merge pull request #783 from mt-caret/next
Fix sample code in m.request documentation
2015-08-28 09:49:55 -04:00
Leo Horie
626144f34c Merge pull request #775 from deomitrus/patch-1
Grammar/spelling fix
2015-08-28 09:20:28 -04:00
Masayuki Takeda
f9953b8f74 m.request: fix sample code in documentation 2015-08-28 22:18:46 +09:00
Deomitrus
322ec7e120 Grammar/spelling fix 2015-08-24 21:08:40 -04:00
Mihail Diordiev
a746d67267 Fix typo in the example of data binding 2015-08-22 19:43:05 +03:00
Mihail Diordiev
57c9cfa76b Fix SyntaxError in the render example 2015-08-20 01:47:27 +03:00
Ivan Borisenko
8a8829c2e1 Module -> mount rename: fix a documentation link 2015-08-18 21:42:08 +03:00
Leo Horie
ed3f3f0686 document component shorthand syntax 2015-07-23 23:43:19 -04:00
Leo Horie
2b24c7a64d changing links to point to absolute path 2015-07-23 23:25:28 -04:00
Leo Horie
a57b1986ac update change log 2015-07-23 23:13:03 -04:00
Leo Horie
34a96d9428 added links to relevant sections 2015-07-23 23:05:09 -04:00
Leo Horie
5baab5f034 update change log 2015-07-23 22:04:43 -04:00
Leo Horie
372cf30e8e docs for catch 2015-07-23 21:52:32 -04:00
Leo Horie
ec1da49fa7 Merge pull request #711 from impinball/ts
Strengthen TS types, add documentation comments, remove diff noise.
2015-07-13 21:20:23 -04:00
Pedro Salgado
3c478fa225 rephrase sentence. 2015-07-13 10:47:22 -06:00
impinball
d4848c0379 Remove trailing whitespace 2015-07-09 03:38:42 -04:00
Leo Horie
1aa3057fed Merge pull request #707 from pelonpelon/patch-17
components.md - eliminate global variable introduced in previous commit
2015-07-07 15:56:34 -04:00
Leo Horie
9da3adaf3d Merge remote-tracking branch 'origin/next' into next 2015-07-07 13:19:00 -04:00
Leo Horie
55aedaabbc fix gzip size in docs 2015-07-07 11:41:47 -04:00
pelonpelon
dc36588160 components.md - eliminate global variable introduced in previous commit
Oops!
2015-07-07 09:04:08 -05:00
Leo Horie
4b2ec49ca9 Merge pull request #636 from pelonpelon/patch-9
Update components.md -- "Classic MVC" example broken
2015-07-06 21:28:44 -04:00
pelonpelon
648343c01c Help users find documentation on unmounting components
It's a common question on Gitter: How do I unmount a component?
Presently this Google Search: `unmount site:http://lhorie.github.io/`
returns one result: `mithril.route.html` -- I have no idea why, there's no "unmount" on the page.

Adding the words unmounting and unmount to this doc page will make them discoverable directly and through Google.
2015-07-02 18:54:59 -05:00
Leo Horie
fe7d0b6c9f fix select2 example 2015-06-29 18:59:41 -04:00
Christopher Venning
00db0b1ec0 Fixed typos in doc links 2015-06-16 16:15:42 -04:00
Jona H.
58d5b306fd fixed bower description
Technically, Bower isn't really a package manager for Node.js, but rather, it's made in Node and built for usage in the frontend, hence why many popular frontend libraries, such as JQuery or Bootstrap have their distributions on there. Bower also has its own package repositories.
2015-06-13 09:47:20 +02:00
Leo Horie
143b7ae3a6 Merge pull request #658 from venning/next
Change JSFiddle example to use Mithril 0.2.0
2015-06-11 15:30:55 -05:00
Christopher Venning
34fe969b61 Change JSFiddle example to use Mithril 0.2.0 2015-06-11 16:12:10 -04:00
Leo Horie
b766b255a8 Merge pull request #657 from shibukawa/patch-5
Update web-services.md
2015-06-11 12:17:48 -05:00
Yoshiki Shibukawa
47e35e32f3 Update web-services.md 2015-06-12 00:57:41 +09:00
Yoshiki Shibukawa
b911d17150 Update mithril.deferred.md 2015-06-12 00:56:03 +09:00
Leo Horie
4f7df003d1 Merge pull request #653 from venning/next
DOCS: missing comma in example
2015-06-11 09:59:58 -05:00
Joe Turner
79b127d094 Clarify order of m.route.mode and m.route
It's not completely obvious that `m.route.mode` needs setting before `m.route` is called (or at least it wasn't to me!), otherwise the initial routing from a URL typed in the location bar fails.  This PR adds a note in the documentation to make this more clear.
2015-06-11 15:28:57 +01:00
Christopher Venning
6ec6ede38a DOCS: missing comma in example 2015-06-09 19:10:51 -04:00
Leo Horie
a5acb12d0c Merge pull request #644 from pelonpelon/patch-10
Minor corrections to getting-started.md
2015-06-03 20:18:09 -05:00
pelonpelon
25cbdbbad5 community.md -- link to github wiki 2015-06-03 13:11:47 -05:00
pelonpelon
3883d029f2 Minor corrections to getting-started.md 2015-06-01 20:27:04 -05:00
pelonpelon
7ce8429bf4 Update components.md -- "Classic MVC" example
@ArthurClemens pointed out in this gitter comment:
https://gitter.im/lhorie/mithril.js?at=55664ba1d21e5ed02ff06e54
that the Classic MVC example is broken:
https://lhorie.github.io/mithril/components.html#classic-mvc

I wanted to show a working jsfiddle with these changes applied, but I couldn't figure out how to get a POST request working. I do, however, have a jsbin that is working, although there are significant changes in the code to allow for GET and POST.
http://jsbin.com/cokesu/2/edit?js,output

A redraw is called for every character entered in the jsbin but AFAICT, not in this PR. I don't know why. It's as though `oninput` is really `onchange`. It's possible to limit the redraw to once when the "save" button is clicked, but this requires a change in logic:

var ContactForm = {
    controller: function(args) {
        this.contact = m.prop(new Contact())
        this.save = function(contact) {
           Observable.trigger("saveContact", {contact: contact})
        }
    },
    view: function(ctrl, args) {
        var contact = ctrl.contact()

        return m("form", [
            m("label", "Name"),
            m("input[name=name]"),

            m("label", "Email"),
            m("input[name=email]"),

            m("button[type=button]", {onclick: function(){
              contact = {
                name: m.prop(this.parentNode.elements.name.value),
                email: m.prop(this.parentNode.elements.email.value)
              }
              ctrl.save(contact)
            
            }}, "Save")
        ])
    }
}
2015-05-28 03:47:40 -05:00
Brendon Murphy
7288afc18e Fix conversion in component stateless example 2015-05-08 20:16:12 -07:00
Daniel Loomer
c622283877 components.md 'trigger', not 'broadcast' 2015-05-07 15:54:51 -04:00
pelonpelon
592f31ee3d Clarification on m.mount() signature 2015-05-07 08:51:36 -05:00
glebcha
809447ed19 corrected typo 2015-05-07 10:37:34 +05:00
glebcha
7c55516d5d added jsfiddle with extended todo app example 2015-05-06 14:00:14 +05:00
Leo Horie
aa9a87ac48 Merge pull request #600 from shibukawa/patch-3
Update components.md
2015-05-04 11:20:36 -04:00
Leo Horie
2f61c535fe Merge pull request #601 from shibukawa/patch-4
Update mithril.route.md
2015-05-04 11:20:06 -04:00
Leo Horie
9d4ba26f50 Merge pull request #602 from shibukawa/patch-5
Update mithril.component.md
2015-05-04 11:19:46 -04:00
Leo Horie
931dbabbcd fix typo 2015-05-03 19:31:05 -04:00
Yoshiki Shibukawa
b70b4191b7 Update mithril.component.md 2015-05-03 18:29:57 +09:00