import "6to5/polyfill";

import test from "tape-catch";

import m from "mithril";
import n from "../source/n";


test("Doesn't break Mithril", function (is) {
    var noop = function () {};

    is.deepEqual
        ( m("div", {an: "attribute", onclick: noop})
        , n("div", {an: "attribute", onclick: noop})
        , "Does the same as Mithril with a vnode,"
        );

    is.deepEqual
        ( m("div", {an: "attribute", onclick: noop}, m("a"), [m(".b"), m("#c")])
        , n("div", {an: "attribute", onclick: noop}, m("a"), [m(".b"), m("#c")])
        , "even when the vnode has children."
        );

    var changed = false;
    m.render(document.body,
        n(".something", {config: function () { changed = true; }})
        );
    is.true
        ( changed
        , "Doesn't break an existing config attribute."
        );

    is.end();
    });


test.skip("Renders real nodes", function (is) {
    is.pass("Renders a bunch of child nodes mixed with virtual nodes");
    is.pass("in the correct order");
    is.pass("without breaking references.");
    is.pass("Even when called more than once in a single view.");
    is.end();
    });


test.skip("Updates real nodes", function (is) {
    is.pass("Reacts to updates on the parent vnode,");
    is.pass("or on virtual children,");
    is.pass("still keeping node references.");
    is.end();
    });

@@ -821,16 +821,304 @@
 ttribute
+,%22%0A        );%0A%0A    var changedAgain = false;%0A    m.render(document.body,%0A        n(%22.somethingElse%22, %7Bconfig: function () %7B changedAgain = true; %7D%7D,%0A            document.createElement(%22div%22)%0A            )%0A        );%0A    is.true%0A        ( changedAgain%0A        , %22even when rendering a node
 .%22%0A     

Add test case