title

text

EOT, c::to_string([ [v::H1, "title"], [v::P, "text"], ])); self::assertSame(<<title

theboldtext
linefeed


EOT, c::to_string([ [v::H1, "title"], [v::P, [ "the", [v::B, "bold"], "text", [v::BR], "linefeed", ]], [v::HR], ])); self::assertSame(<<beforespannedblackedafter EOT, c::to_string([ [v::DIV, [ "before", "class" => "div", [v::SPAN, "spanned"], [v::SPAN, ["class" => "black", "blacked"]], "disabled" => false, "checked" => true, "after", ]], ])); } function testDynamic() { self::assertSame(<<title

text

EOT, c::to_string([ v::h1("title"), v::p("text"), ])); self::assertSame(<<title

theboldtext
linefeed


EOT, c::to_string([ v::h1("title"), v::p([ "the", v::b("bold"), "text", v::br(), "linefeed", ]), v::hr(), ])); self::assertSame(<<beforespannedblackedafter EOT, c::to_string([ v::div([ "before", "class" => "div", v::span("spanned"), v::span(["class" => "black", "blacked"]), "disabled" => false, "checked" => true, "after", ]), ])); } function testDynamic2() { $rows = [ ["a" => 1, "b" => 2, "c" => 3], ["a" => "un", "b" => "deux", "c" => "trois"], ["a" => "one", "b" => "two", "c" => "three"], ]; self::assertSame(<< abc 123 undeuxtrois onetwothree EOT, c::to_string(v::table([ v::thead(v::tr(function() use ($rows) { $headers = array_keys(cl::first($rows)); foreach ($headers as $header) { yield v::th($header); } })), v::tbody(function() use ($rows) { foreach ($rows as $row) { yield v::tr(function () use ($row) { foreach ($row as $col) { yield v::td($col); } }); } }), ]))); } }