diff --git a/Gemfile b/Gemfile index 8386398b..ca6e1012 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ gemspec group :test do gem "sus" - gem "quickdraw", github: "joeldrapper/quickdraw" + gem "quickdraw", github: "joeldrapper/quickdraw", branch: "assert-style" gem "simplecov", require: false gem "selenium-webdriver" end diff --git a/lib/phlex/html/standard_elements.rb b/lib/phlex/html/standard_elements.rb index c267a9a6..94ae9777 100644 --- a/lib/phlex/html/standard_elements.rb +++ b/lib/phlex/html/standard_elements.rb @@ -17,7 +17,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<abbr>` tag. # The `<abbr>` element represents an abbreviation or acronym. # See https://developer.mozilla.org/docs/Web/HTML/Element/abbr @@ -28,7 +27,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<address>` tag. # The `<address>` element indicates contact information for a person or organization. # See https://developer.mozilla.org/docs/Web/HTML/Element/address @@ -38,7 +36,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<article>` tag. # The `<article>` element represents a self-contained composition in a document, page, application, or site. # See https://developer.mozilla.org/docs/Web/HTML/Element/article @@ -48,7 +45,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<aside>` tag. # The `<aside>` element represents a section of a page that consists of content that is tangentially related to the content around the aside element. # See https://developer.mozilla.org/docs/Web/HTML/Element/aside @@ -58,7 +54,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<audio>` tag. # See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio register_element def audio( @@ -71,7 +66,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<b>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/b register_element def b( @@ -80,7 +74,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<bdi>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/bdi register_element def bdi( @@ -89,7 +82,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<bdo>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/bdo register_element def bdo( @@ -99,7 +91,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<blockquote>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/blockquote register_element def blockquote( @@ -109,7 +100,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<body>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/body register_element def body( @@ -118,7 +108,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<button>` tag. # The `<button>` element is an interactive element activated by a user with a mouse, keyboard, finger, voice command, or other assistive technology to perform an action, such as submitting a form or opening a dialog. # See https://developer.mozilla.org/docs/Web/HTML/Element/button @@ -140,7 +129,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<canvas>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/canvas register_element def canvas( @@ -151,7 +139,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<caption>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/caption register_element def caption( @@ -160,7 +147,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<cite>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/cite register_element def cite( @@ -169,7 +155,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<code>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/code register_element def code( @@ -178,7 +163,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<colgroup>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/colgroup register_element def colgroup( @@ -188,7 +172,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<data>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/data register_element def data( @@ -198,7 +181,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<datalist>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/datalist register_element def datalist( @@ -207,7 +189,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<dd>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/dd register_element def dd( @@ -216,7 +197,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<del>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/del register_element def del( @@ -227,7 +207,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<details>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/details register_element def details( @@ -237,7 +216,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<dfn>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/dfn register_element def dfn( @@ -247,7 +225,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<dialog>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/dialog register_element def dialog( @@ -257,7 +234,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<div>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/div register_element def div( @@ -266,7 +242,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<dl>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/dl register_element def dl( @@ -275,7 +250,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<dt>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/dt register_element def dt( @@ -284,7 +258,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<em>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/em register_element def em( @@ -293,7 +266,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<fieldset>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/fieldset register_element def fieldset( @@ -305,7 +277,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<figcaption>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/figcaption register_element def figcaption( @@ -314,7 +285,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<figure>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/figure register_element def figure( @@ -323,7 +293,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<footer>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/footer register_element def footer( @@ -332,7 +301,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<form>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/form register_element def form( @@ -344,7 +312,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<h1>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/h1 register_element def h1( @@ -353,7 +320,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<h2>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/h2 register_element def h2( @@ -362,7 +328,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<h3>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/h3 register_element def h3( @@ -371,7 +336,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<h4>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/h4 register_element def h4( @@ -380,7 +344,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<h5>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/h5 register_element def h5( @@ -389,7 +352,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<h6>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/h6 register_element def h6( @@ -398,7 +360,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<head>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/head register_element def head( @@ -407,7 +368,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<header>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/header register_element def header( @@ -416,7 +376,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<hgroup>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/hgroup register_element def hgroup( @@ -425,7 +384,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<html>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/html register_element def html( @@ -435,7 +393,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<i>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/i register_element def i( @@ -444,7 +401,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<iframe>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/iframe register_element def iframe( @@ -458,7 +414,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<ins>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/ins register_element def ins( @@ -469,7 +424,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<kbd>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/kbd register_element def kbd( @@ -478,7 +432,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<label>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/label register_element def label( @@ -489,7 +442,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<legend>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/legend register_element def legend( @@ -498,7 +450,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<li>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/li register_element def li( @@ -508,7 +459,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<main>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/main register_element def main( @@ -517,7 +467,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<map>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/map register_element def map( @@ -527,7 +476,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<mark>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/mark register_element def mark( @@ -536,7 +484,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<menu>` tag. # See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/menu register_element def menu( @@ -546,7 +493,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<meter>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/meter register_element def meter( @@ -561,7 +507,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<nav>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/nav register_element def nav( @@ -570,7 +515,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<noscript>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/noscript register_element def noscript( @@ -579,7 +523,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<object>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/object register_element def object( @@ -592,7 +535,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<ol>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/ol register_element def ol( @@ -604,7 +546,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<optgroup>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/optgroup register_element def optgroup( @@ -615,7 +556,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<option>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/option register_element def option( @@ -627,7 +567,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<output>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/output register_element def output( @@ -639,7 +578,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<p>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/p register_element def p( @@ -648,7 +586,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<picture>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/picture register_element def picture( @@ -657,7 +594,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<portal>` tag. (Experimental) # See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/portal register_element def portal( @@ -667,7 +603,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<pre>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/pre register_element def pre( @@ -676,7 +611,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<progress>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/progress register_element def progress( @@ -687,7 +621,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<q>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/q register_element def q( @@ -697,7 +630,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<rp>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/rp register_element def rp( @@ -706,7 +638,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<rt>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/rt register_element def rt( @@ -715,7 +646,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<ruby>` tag. (The best tag ever!) # See https://developer.mozilla.org/docs/Web/HTML/Element/ruby register_element def ruby( @@ -724,7 +654,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<s>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/s register_element def s( @@ -733,7 +662,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<samp>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/samp register_element def samp( @@ -742,7 +670,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<script>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/script register_element def script( @@ -755,7 +682,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<search>` tag. # See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/search register_element def search( @@ -764,7 +690,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<section>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/section register_element def section( @@ -773,7 +698,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<select>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/select register_element def select( @@ -785,7 +709,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<slot>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/slot register_element def slot( @@ -795,7 +718,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<small>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/small register_element def small( @@ -804,7 +726,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<span>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/span register_element def span( @@ -813,7 +734,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<strong>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/strong register_element def strong( @@ -822,7 +742,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<style>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/style register_element def style( @@ -833,7 +752,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<sub>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/sub register_element def sub( @@ -842,7 +760,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<summary>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/summary register_element def summary( @@ -851,7 +768,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<sup>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/sup register_element def sup( @@ -860,7 +776,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs an `<svg>` tag. # See https://developer.mozilla.org/en-US/docs/Web/SVG/Element/svg register_element def svg( @@ -872,7 +787,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<table>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/table register_element def table( @@ -881,7 +795,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<tbody>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/tbody register_element def tbody( @@ -890,7 +803,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<td>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/td register_element def td( @@ -902,7 +814,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<template>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/template register_element def template( @@ -911,7 +822,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<textarea>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/textarea register_element def textarea( @@ -925,7 +835,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<tfoot>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/tfoot register_element def tfoot( @@ -934,7 +843,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<th>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/th register_element def th( @@ -947,7 +855,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<thead>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/thead register_element def thead( @@ -956,7 +863,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<time>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/time register_element def time( @@ -966,7 +872,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<title>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/title register_element def title( @@ -975,7 +880,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<tr>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/tr register_element def tr( @@ -984,7 +888,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<u>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/u register_element def u( @@ -993,7 +896,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<ul>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/ul register_element def ul( @@ -1002,7 +904,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<var>` tag. # See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/var register_element def var( @@ -1011,7 +912,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<video>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/video register_element def video( @@ -1026,7 +926,6 @@ module Phlex::HTML::StandardElements **attributes, &content ) = nil - # Outputs a `<wbr>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/wbr register_element def wbr( diff --git a/lib/phlex/html/void_elements.rb b/lib/phlex/html/void_elements.rb index 64ead924..1c82fa82 100644 --- a/lib/phlex/html/void_elements.rb +++ b/lib/phlex/html/void_elements.rb @@ -11,7 +11,6 @@ module Phlex::HTML::VoidElements id: nil, **attributes ) = nil - # Outputs a `<base>` tag. # See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base __register_void_element__ def base( @@ -21,7 +20,6 @@ module Phlex::HTML::VoidElements target: nil, **attributes ) = nil - # Outputs a `<br>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/br __register_void_element__ def br( @@ -29,7 +27,6 @@ module Phlex::HTML::VoidElements id: nil, **attributes ) = nil - # Outputs a `<col>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/col __register_void_element__ def col( @@ -37,7 +34,6 @@ module Phlex::HTML::VoidElements id: nil, **attributes ) = nil - # Outputs an `<embed>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/embed __register_void_element__ def embed( @@ -45,7 +41,6 @@ module Phlex::HTML::VoidElements id: nil, **attributes ) = nil - # Outputs an `<hr>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/hr __register_void_element__ def hr( @@ -53,7 +48,6 @@ module Phlex::HTML::VoidElements id: nil, **attributes ) = nil - # Outputs an `<img>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/img __register_void_element__ def img( @@ -63,7 +57,6 @@ module Phlex::HTML::VoidElements src: nil, **attributes ) = nil - # Outputs an `<input>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/input __register_void_element__ def input( @@ -73,7 +66,6 @@ module Phlex::HTML::VoidElements type: nil, **attributes ) = nil - # Outputs a `<link>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/link __register_void_element__ def link( @@ -81,7 +73,6 @@ module Phlex::HTML::VoidElements id: nil, **attributes ) = nil - # Outputs a `<meta>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/meta __register_void_element__ def meta( @@ -91,7 +82,6 @@ module Phlex::HTML::VoidElements name: nil, **attributes ) = nil - # Outputs a `<source>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/source __register_void_element__ def source( @@ -99,7 +89,6 @@ module Phlex::HTML::VoidElements id: nil, **attributes ) = nil - # Outputs a `<track>` tag. # See https://developer.mozilla.org/docs/Web/HTML/Element/track __register_void_element__ def track( diff --git a/lib/phlex/svg/standard_elements.rb b/lib/phlex/svg/standard_elements.rb index e14634a4..17fe24d1 100644 --- a/lib/phlex/svg/standard_elements.rb +++ b/lib/phlex/svg/standard_elements.rb @@ -17,7 +17,6 @@ module Phlex::SVG::StandardElements **attributes, &content ) = nil - # Outputs an `<animate>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/animate register_element def animate( @@ -28,7 +27,6 @@ module Phlex::SVG::StandardElements **attributes, &content ) = nil - # Outputs an `<animateMotion>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/animateMotion register_element def animateMotion( @@ -54,427 +52,366 @@ module Phlex::SVG::StandardElements **attributes, &content ) = nil - # Outputs an `<animateTransform>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/animateTransform register_element def animateTransform( **attributes, &content ) = nil - # Outputs a `<circle>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/circle register_element def circle( **attributes, &content ) = nil - # Outputs a `<clipPath>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/clipPath register_element def clipPath( **attributes, &content ) = nil - # Outputs a `<defs>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/defs register_element def defs( **attributes, &content ) = nil - # Outputs a `<desc>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/desc register_element def desc( **attributes, &content ) = nil - # Outputs a `<discard>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/discard register_element def discard( **attributes, &content ) = nil - # Outputs an `<ellipse>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/ellipse register_element def ellipse( **attributes, &content ) = nil - # Outputs an `<feBlend>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feBlend register_element def feBlend( **attributes, &content ) = nil - # Outputs an `<feColorMatrix>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feColorMatrix register_element def feColorMatrix( **attributes, &content ) = nil - # Outputs an `<feComponentTransfer>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feComponentTransfer register_element def feComponentTransfer( **attributes, &content ) = nil - # Outputs an `<feComposite>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feComposite register_element def feComposite( **attributes, &content ) = nil - # Outputs an `<feConvolveMatrix>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feConvolveMatrix register_element def feConvolveMatrix( **attributes, &content ) = nil - # Outputs an `<feDiffuseLighting>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feDiffuseLighting register_element def feDiffuseLighting( **attributes, &content ) = nil - # Outputs an `<feDisplacementMap>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feDisplacementMap register_element def feDisplacementMap( **attributes, &content ) = nil - # Outputs an `<feDistantLight>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feDistantLight register_element def feDistantLight( **attributes, &content ) = nil - # Outputs an `<feDropShadow>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feDropShadow register_element def feDropShadow( **attributes, &content ) = nil - # Outputs an `<feFlood>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feFlood register_element def feFlood( **attributes, &content ) = nil - # Outputs an `<feFuncA>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feFuncA register_element def feFuncA( **attributes, &content ) = nil - # Outputs an `<feFuncB>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feFuncB register_element def feFuncB( **attributes, &content ) = nil - # Outputs an `<feFuncG>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feFuncG register_element def feFuncG( **attributes, &content ) = nil - # Outputs an `<feFuncR>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feFuncR register_element def feFuncR( **attributes, &content ) = nil - # Outputs an `<feGaussianBlur>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feGaussianBlur register_element def feGaussianBlur( **attributes, &content ) = nil - # Outputs an `<feImage>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feImage register_element def feImage( **attributes, &content ) = nil - # Outputs an `<feMerge>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feMerge register_element def feMerge( **attributes, &content ) = nil - # Outputs an `<feMergeNode>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feMergeNode register_element def feMergeNode( **attributes, &content ) = nil - # Outputs an `<feMorphology>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feMorphology register_element def feMorphology( **attributes, &content ) = nil - # Outputs an `<feOffset>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feOffset register_element def feOffset( **attributes, &content ) = nil - # Outputs an `<fePointLight>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/fePointLight register_element def fePointLight( **attributes, &content ) = nil - # Outputs an `<feSpecularLighting>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feSpecularLighting register_element def feSpecularLighting( **attributes, &content ) = nil - # Outputs an `<feSpotLight>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feSpotLight register_element def feSpotLight( **attributes, &content ) = nil - # Outputs an `<feTile>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feTile register_element def feTile( **attributes, &content ) = nil - # Outputs an `<feTurbulence>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/feTurbulence register_element def feTurbulence( **attributes, &content ) = nil - # Outputs a `<filter>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/filter register_element def filter( **attributes, &content ) = nil - # Outputs a `<foreignObject>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/foreignObject register_element def foreignObject( **attributes, &content ) = nil - # Outputs a `<g>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/g register_element def g( **attributes, &content ) = nil - # Outputs an `<image>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/image register_element def image( **attributes, &content ) = nil - # Outputs a `<line>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/line register_element def line( **attributes, &content ) = nil - # Outputs a `<linearGradient>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/linearGradient register_element def linearGradient( **attributes, &content ) = nil - # Outputs a `<marker>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/marker register_element def marker( **attributes, &content ) = nil - # Outputs a `<mask>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/mask register_element def mask( **attributes, &content ) = nil - # Outputs a `<metadata>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/metadata register_element def metadata( **attributes, &content ) = nil - # Outputs an `<mpath>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/mpath register_element def mpath( **attributes, &content ) = nil - # Outputs a `<path>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/path register_element def path( **attributes, &content ) = nil - # Outputs a `<pattern>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/pattern register_element def pattern( **attributes, &content ) = nil - # Outputs a `<polygon>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/polygon register_element def polygon( **attributes, &content ) = nil - # Outputs a `<polyline>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/polyline register_element def polyline( **attributes, &content ) = nil - # Outputs a `<radialGradient>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/radialGradient register_element def radialGradient( **attributes, &content ) = nil - # Outputs a `<rect>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/rect register_element def rect( **attributes, &content ) = nil - # Outputs a `<script>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/script register_element def script( **attributes, &content ) = nil - # Outputs a `<set>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/set register_element def set( **attributes, &content ) = nil - # Outputs a `<stop>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/stop register_element def stop( **attributes, &content ) = nil - # Outputs a `<style>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/style register_element def style( **attributes, &content ) = nil - # Outputs an `<svg>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/svg register_element def svg( **attributes, &content ) = nil - # Outputs a `<switch>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/switch register_element def switch( **attributes, &content ) = nil - # Outputs a `<symbol>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/symbol register_element def symbol( **attributes, &content ) = nil - # Outputs a `<text>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/text register_element def text( **attributes, &content ) = nil - # Outputs a `<textPath>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/textPath register_element def textPath( **attributes, &content ) = nil - # Outputs a `<title>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/title register_element def title( **attributes, &content ) = nil - # Outputs a `<tspan>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/tspan register_element def tspan( **attributes, &content ) = nil - # Outputs a `<use>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/use register_element def use( **attributes, &content ) = nil - # Outputs a `<view>` tag. # See https://developer.mozilla.org/docs/Web/SVG/Element/view register_element def view( diff --git a/quickdraw/caching.test.rb b/quickdraw/caching.test.rb index 17e6d450..a5299d02 100644 --- a/quickdraw/caching.test.rb +++ b/quickdraw/caching.test.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true test "using a component without a source location" do - expect { + refute_raises do # Intentionally not passing a source location here. eval <<~RUBY class Example < Phlex::HTML @@ -9,5 +9,5 @@ def view_template end end RUBY - }.not_to_raise + end end diff --git a/quickdraw/csv.test.rb b/quickdraw/csv.test.rb index 84c4f0ad..5c9ddb36 100644 --- a/quickdraw/csv.test.rb +++ b/quickdraw/csv.test.rb @@ -39,7 +39,7 @@ def render_headers? Product.new(" Banana ", 2.00), ] - expect(Example.new(products).call) == <<~CSV + assert_equal Example.new(products).call, <<~CSV name,price Apple,1.0 " Banana ",2.0 @@ -52,7 +52,7 @@ def render_headers? Product.new("Banana ", 2.00), ] - expect(TrimWhitespace.new(products).call) == <<~CSV + assert_equal TrimWhitespace.new(products).call, <<~CSV name,price Apple,1.0 Banana,2.0 @@ -65,7 +65,7 @@ def render_headers? Product.new("Banana", "+C2"), ] - expect(EscapeCSVInjection.new(products).call) == <<~CSV + assert_equal EscapeCSVInjection.new(products).call, <<~CSV name,price Apple,"'=SUM(A1:B1)" Banana,"'+C2" @@ -78,16 +78,18 @@ def render_headers? Product.new("Banana", 2.00), ] - expect(NoHeaders.new(products).call) == <<~CSV + assert_equal NoHeaders.new(products).call, <<~CSV Apple,1.0 Banana,2.0 CSV end test "content type" do - expect(Example.new([]).content_type) == "text/csv" + assert_equal Example.new([]).content_type, "text/csv" end test "raises an error if there's no escape plan" do - expect { Base.new([]).call }.to_raise + assert_raises(RuntimeError) do + Base.new([]).call + end end diff --git a/quickdraw/fifo.test.rb b/quickdraw/fifo.test.rb index 3c5eba68..f052d2cc 100644 --- a/quickdraw/fifo.test.rb +++ b/quickdraw/fifo.test.rb @@ -7,7 +7,7 @@ fifo[i] = "a" end - expect(fifo.size) == 3 + assert_equal fifo.size, 3 end test "reading a key" do @@ -15,7 +15,7 @@ fifo[0] = "a" - expect(fifo[0]) == "a" + assert_equal fifo[0], "a" end test "ignores values that are too large" do @@ -24,5 +24,5 @@ fifo[1] = "a" * 10 fifo[2] = "a" * 11 - expect(fifo.size) == 1 + assert_equal fifo.size, 1 end diff --git a/quickdraw/helpers/grab.test.rb b/quickdraw/helpers/grab.test.rb index d648ea2b..d9e4be21 100644 --- a/quickdraw/helpers/grab.test.rb +++ b/quickdraw/helpers/grab.test.rb @@ -4,10 +4,10 @@ test "single binding" do output = grab(class: "foo") - expect(output) == "foo" + assert_equal output, "foo" end test "multiple bindings" do output = grab(class: "foo", if: "bar") - expect(output) == ["foo", "bar"] + assert_equal output, ["foo", "bar"] end diff --git a/quickdraw/helpers/mix.test.rb b/quickdraw/helpers/mix.test.rb index e5fe1922..720acd72 100644 --- a/quickdraw/helpers/mix.test.rb +++ b/quickdraw/helpers/mix.test.rb @@ -4,27 +4,27 @@ test "nil + string" do output = mix({ class: nil }, { class: "a" }) - expect(output) == { class: "a" } + assert_equal output, { class: "a" } end test "string + nil" do output = mix({ class: "a" }, { class: nil }) - expect(output) == { class: "a" } + assert_equal output, { class: "a" } end test "array + nil" do output = mix({ class: ["foo", "bar"] }, { class: nil }) - expect(output) == { class: ["foo", "bar"] } + assert_equal output, { class: ["foo", "bar"] } end test "array + array" do output = mix({ class: ["foo"] }, { class: ["bar"] }) - expect(output) == { class: ["foo", "bar"] } + assert_equal output, { class: ["foo", "bar"] } end test "array + set" do output = mix({ class: ["foo"] }, { class: Set["bar"] }) - expect(output) == { class: ["foo", "bar"] } + assert_equal output, { class: ["foo", "bar"] } end test "array + hash" do @@ -33,12 +33,12 @@ { data: { controller: "bar" } }, ) - expect(output) == { data: { controller: "bar" } } + assert_equal output, { data: { controller: "bar" } } end test "array + string" do output = mix({ class: ["foo"] }, { class: "bar" }) - expect(output) == { class: ["foo", "bar"] } + assert_equal output, { class: ["foo", "bar"] } end test "hash + hash" do @@ -47,40 +47,40 @@ { data: { controller: "bar" } }, ) - expect(output) == { data: { controller: "foo bar" } } + assert_equal output, { data: { controller: "foo bar" } } end test "string + array" do output = mix({ class: "foo" }, { class: ["bar"] }) - expect(output) == { class: ["foo", "bar"] } + assert_equal output, { class: ["foo", "bar"] } end test "string + string" do output = mix({ class: "foo" }, { class: "bar" }) - expect(output) == { class: "foo bar" } + assert_equal output, { class: "foo bar" } end test "string + set" do output = mix({ class: "foo" }, { class: Set["bar"] }) - expect(output) == { class: ["foo", "bar"] } + assert_equal output, { class: ["foo", "bar"] } end test "override" do output = mix({ class: "foo" }, { class!: "bar" }) - expect(output) == { class: "bar" } + assert_equal output, { class: "bar" } end test "set + set" do output = mix({ class: Set["foo"] }, { class: Set["bar"] }) - expect(output) == { class: Set["foo", "bar"] } + assert_equal output, { class: Set["foo", "bar"] } end test "set + array" do output = mix({ class: Set["foo"] }, { class: ["bar"] }) - expect(output) == { class: ["foo", "bar"] } + assert_equal output, { class: ["foo", "bar"] } end test "set + string" do output = mix({ class: Set["foo"] }, { class: "bar" }) - expect(output) == { class: ["foo", "bar"] } + assert_equal output, { class: ["foo", "bar"] } end diff --git a/quickdraw/html.test.rb b/quickdraw/html.test.rb index be4331ab..1ef3aad3 100644 --- a/quickdraw/html.test.rb +++ b/quickdraw/html.test.rb @@ -2,5 +2,6 @@ test "content type" do component = Class.new(Phlex::HTML) - expect(component.new.content_type) == "text/html" + + assert_equal component.new.content_type, "text/html" end diff --git a/quickdraw/html/doctype.test.rb b/quickdraw/html/doctype.test.rb index efddc14d..a9607bf7 100644 --- a/quickdraw/html/doctype.test.rb +++ b/quickdraw/html/doctype.test.rb @@ -11,5 +11,5 @@ def view_template end test do - expect(Example.call) == "<html><head><!doctype html></head></html>" + assert_equal Example.call, "<html><head><!doctype html></head></html>" end diff --git a/quickdraw/html/standard_elements.test.rb b/quickdraw/html/standard_elements.test.rb index ef0c4708..e6fde44f 100644 --- a/quickdraw/html/standard_elements.test.rb +++ b/quickdraw/html/standard_elements.test.rb @@ -8,7 +8,7 @@ end end - expect(example.call) == %(<#{tag} class="class" id="id" disabled><h1>Hello</h1></#{tag}>) + assert_equal example.call, %(<#{tag} class="class" id="id" disabled><h1>Hello</h1></#{tag}>) end test "<#{tag}> with block text content and attributes" do @@ -18,7 +18,7 @@ end end - expect(example.call) == %(<#{tag} class="class" id="id" disabled>content</#{tag}>) + assert_equal example.call, %(<#{tag} class="class" id="id" disabled>content</#{tag}>) end test "<#{tag}> with string attribute keys" do @@ -28,7 +28,7 @@ end end - expect(example.call) == %(<#{tag} attribute_with_underscore>content</#{tag}>) + assert_equal example.call, %(<#{tag} attribute_with_underscore>content</#{tag}>) end test "<#{tag}> with hash attribute values" do @@ -38,6 +38,6 @@ end end - expect(example.call) == %(<#{tag} aria-hidden data-turbo-frame="_top">content</#{tag}>) + assert_equal example.call, %(<#{tag} aria-hidden data-turbo-frame="_top">content</#{tag}>) end end diff --git a/quickdraw/html/svg.test.rb b/quickdraw/html/svg.test.rb index 65ec0d7a..9e9bf44e 100644 --- a/quickdraw/html/svg.test.rb +++ b/quickdraw/html/svg.test.rb @@ -15,9 +15,9 @@ def view_template end test "rendering SVG without content" do - expect(ExampleWithoutContent.call) == %(<svg></svg>) + assert_equal %(<svg></svg>), ExampleWithoutContent.call end test "rendering SVG inside HTML components" do - expect(Example.call) == %(<svg><path d="321"></path></svg>) + assert_equal %(<svg><path d="321"></path></svg>), Example.call end diff --git a/quickdraw/html/void_elements.test.rb b/quickdraw/html/void_elements.test.rb index 44466d62..bee9d64a 100644 --- a/quickdraw/html/void_elements.test.rb +++ b/quickdraw/html/void_elements.test.rb @@ -8,7 +8,7 @@ end end - expect(example.call) == %(<#{tag} class="class" id="id" disabled>) + assert_equal(example.call, %(<#{tag} class="class" id="id" disabled>)) end test "<#{tag}> with string attribute keys" do @@ -18,7 +18,7 @@ end end - expect(example.call) == %(<#{tag} attribute_with_underscore>) + assert_equal(example.call, %(<#{tag} attribute_with_underscore>)) end test "<#{tag}> with hash attribute values" do @@ -28,6 +28,6 @@ end end - expect(example.call) == %(<#{tag} aria-hidden data-turbo-frame="_top">) + assert_equal(example.call, %(<#{tag} aria-hidden data-turbo-frame="_top">)) end end diff --git a/quickdraw/kit.test.rb b/quickdraw/kit.test.rb index c707b567..dfbc47bd 100644 --- a/quickdraw/kit.test.rb +++ b/quickdraw/kit.test.rb @@ -12,11 +12,10 @@ def view_template end test "raises when you try to render a component outside of a rendering context" do - expect { Components::SayHi("Joel") }.to_raise(RuntimeError) do |error| - expect(error.message) == "You can't call `SayHi' outside of a Phlex rendering context." - end + error = assert_raises(RuntimeError) { Components::SayHi("Joel") } + assert_equal error.message, "You can't call `SayHi' outside of a Phlex rendering context." end test "defines methods for its components" do - expect(Example.new.call) == %(<article><h1>Hi Joel</h1><h1>Hi Joel</h1>Inside</article><article><h1>Hi Will</h1>Inside</article>) + assert_equal Example.new.call, %(<article><h1>Hi Joel</h1><h1>Hi Joel</h1>Inside</article><article><h1>Hi Will</h1>Inside</article>) end diff --git a/quickdraw/sgml.test.rb b/quickdraw/sgml.test.rb index 914fe69c..e2958db5 100644 --- a/quickdraw/sgml.test.rb +++ b/quickdraw/sgml.test.rb @@ -6,7 +6,7 @@ def view_template end end - expect(component.new.call) == "" + assert_equal component.new.call, "" end test "components with old `template` method render warning" do @@ -16,7 +16,7 @@ def template end end - expect(component.new.call) == Phlex::Escape.html_escape( + assert_equal component.new.call, Phlex::Escape.html_escape( %(Phlex Warning: Your `#{component.name}` class doesn't define a `view_template` method. If you are upgrading to Phlex 2.x make sure to rename your `template` method to `view_template`. See: https://beta.phlex.fun/guides/v2-upgrade.html) ) end @@ -24,7 +24,7 @@ def template test "components with no `view_template` method render warning" do component = Class.new(Phlex::HTML) - expect(component.new.call) == Phlex::Escape.html_escape( + assert_equal component.new.call, Phlex::Escape.html_escape( %(Phlex Warning: Your `#{component.name}` class doesn't define a `view_template` method. If you are upgrading to Phlex 2.x make sure to rename your `template` method to `view_template`. See: https://beta.phlex.fun/guides/v2-upgrade.html) ) end @@ -34,5 +34,6 @@ def template instance = component.new instance.call - expect { instance.call }.to_raise(Phlex::DoubleRenderError) + + assert_raises(Phlex::DoubleRenderError) { instance.call } end diff --git a/quickdraw/sgml/attributes.test.rb b/quickdraw/sgml/attributes.test.rb index 6af6da6f..169016f3 100644 --- a/quickdraw/sgml/attributes.test.rb +++ b/quickdraw/sgml/attributes.test.rb @@ -5,613 +5,519 @@ include SGMLHelper test "id attributes must be lower case symbols" do - expect { phlex { div("id" => "abc") } }.to_raise(Phlex::ArgumentError) - expect { phlex { div("ID" => "abc") } }.to_raise(Phlex::ArgumentError) - expect { phlex { div(:ID => "abc") } }.to_raise(Phlex::ArgumentError) + assert_raises(Phlex::ArgumentError) { phlex { div("id" => "abc") } } + assert_raises(Phlex::ArgumentError) { phlex { div("ID" => "abc") } } + assert_raises(Phlex::ArgumentError) { phlex { div(:ID => "abc") } } - expect( - phlex { div(id: "abc") }, - ) == %(<div id="abc"></div>) + output = phlex { div(id: "abc") } + assert_equal output, %(<div id="abc"></div>) end test "*invalid*, _" do - expect { phlex { div(Object.new => "abc") } }.to_raise(Phlex::ArgumentError) do |error| - expect(error.message) == "Attribute keys should be Strings or Symbols." + error = assert_raises(Phlex::ArgumentError) do + phlex { div(Object.new => "abc") } end + + assert_equal error.message, "Attribute keys should be Strings or Symbols." end test "unsafe event attribute" do - expect { phlex { div("onclick" => true) } }.to_raise(Phlex::ArgumentError) do |error| - expect(error.message) == "Unsafe attribute name detected: onclick." + error = assert_raises(Phlex::ArgumentError) do + phlex { div("onclick" => true) } end + + assert_equal error.message, "Unsafe attribute name detected: onclick." end test "href with hash" do - expect { + error = assert_raises(Phlex::ArgumentError) do phlex { a(href: {}) } - }.to_raise(Phlex::ArgumentError) do |error| - expect(error.message) == "Invalid attribute value for href: #{{}.inspect}." end + + assert_equal error.message, "Invalid attribute value for href: #{{}.inspect}." end test "unsafe href attribute" do - expect( - phlex { div(href: "javascript:alert('hello')") }, - ) == %(<div></div>) - - expect( - phlex { div(href: "Javascript:alert('hello')") }, - ) == %(<div></div>) - - expect( - phlex { div("href" => "javascript:alert('hello')") }, - ) == %(<div></div>) - - expect( - phlex { div("Href" => "javascript:alert('hello')") }, - ) == %(<div></div>) - - expect( - phlex { div("Href" => "javascript:javascript:alert('hello')") }, - ) == %(<div></div>) - - expect( - phlex { div(href: " \t\njavascript:alert('hello')") }, - ) == %(<div></div>) + [ + phlex { a(href: "javascript:alert('hello')") }, + phlex { a(href: "Javascript:alert('hello')") }, + phlex { a("href" => "javascript:alert('hello')") }, + phlex { a("Href" => "javascript:alert('hello')") }, + phlex { a("Href" => "javascript:javascript:alert('hello')") }, + phlex { a(href: " \t\njavascript:alert('hello')") }, + ].each do |output| + assert_equal output, %(<a></a>) + end end -test "unsafe attribute name with escape characters" do - expect { +test "unsafe attribute name <" do + error = assert_raises(Phlex::ArgumentError) do phlex { div("<" => true) } - }.to_raise(Phlex::ArgumentError) do |error| - expect(error.message) == "Unsafe attribute name detected: <." end - expect { + assert_equal error.message, "Unsafe attribute name detected: <." +end + +test "unsafe attribute name >" do + error = assert_raises(Phlex::ArgumentError) do phlex { div(">" => true) } - }.to_raise(Phlex::ArgumentError) do |error| - expect(error.message) == "Unsafe attribute name detected: >." end - expect { + assert_equal error.message, "Unsafe attribute name detected: >." +end + +test "unsafe attribute name &" do + error = assert_raises(Phlex::ArgumentError) do phlex { div("&" => true) } - }.to_raise(Phlex::ArgumentError) do |error| - expect(error.message) == "Unsafe attribute name detected: &." end - expect { + assert_equal error.message, "Unsafe attribute name detected: &." +end + +test "unsafe attribute name '" do + error = assert_raises(Phlex::ArgumentError) do phlex { div("'" => true) } - }.to_raise(Phlex::ArgumentError) do |error| - expect(error.message) == "Unsafe attribute name detected: '." end - expect { + assert_equal error.message, "Unsafe attribute name detected: '." +end + +test "unsafe attribute name \"" do + error = assert_raises(Phlex::ArgumentError) do phlex { div('"' => true) } - }.to_raise(Phlex::ArgumentError) do |error| - expect(error.message) == "Unsafe attribute name detected: \"." end + + assert_equal error.message, "Unsafe attribute name detected: \"." end test "_, nil" do - expect( - phlex { div(attribute: nil) }, - ) == %(<div></div>) + output = phlex { div(attribute: nil) } + assert_equal output, %(<div></div>) end test "_, true" do - expect( - phlex { div(attribute: true) }, - ) == %(<div attribute></div>) + output = phlex { div(attribute: true) } + assert_equal output, %(<div attribute></div>) end test "_, false" do - expect( - phlex { div(attribute: false) }, - ) == %(<div></div>) + output = phlex { div(attribute: false) } + assert_equal output, %(<div></div>) end test "_, String" do - expect( - phlex { div(attribute: "") }, - ) == %(<div attribute=""></div>) + with_empty_string = phlex { div(attribute: "") } + assert_equal with_empty_string, %(<div attribute=""></div>) - expect( - phlex { div(attribute: "test") }, - ) == %(<div attribute="test"></div>) + with_regular_string = phlex { div(attribute: "test") } + assert_equal with_regular_string, %(<div attribute="test"></div>) - expect( - phlex { div(attribute: "with_underscores") }, - ) == %(<div attribute="with_underscores"></div>) + with_underscores = phlex { div(attribute: "with_underscores") } + assert_equal with_underscores, %(<div attribute="with_underscores"></div>) - expect( - phlex { div(attribute: "with-dashes") }, - ) == %(<div attribute="with-dashes"></div>) + with_dashes = phlex { div(attribute: "with-dashes") } + assert_equal with_dashes, %(<div attribute="with-dashes"></div>) - expect( - phlex { div(attribute: "with spaces") }, - ) == %(<div attribute="with spaces"></div>) + with_spaces = phlex { div(attribute: "with spaces") } + assert_equal with_spaces, %(<div attribute="with spaces"></div>) - expect( - phlex { div(attribute: "with 'single quotes'") }, - ) == %(<div attribute="with 'single quotes'"></div>) + with_single_quotes = phlex { div(attribute: "with 'single quotes'") } + assert_equal with_single_quotes, %(<div attribute="with 'single quotes'"></div>) - expect( - phlex { div(attribute: "with <html>") }, - ) == %(<div attribute="with <html>"></div>) + with_html = phlex { div(attribute: "with <html>") } + assert_equal with_html, %(<div attribute="with <html>"></div>) - expect( - phlex { div(attribute: 'with "double quotes"') }, - ) == %(<div attribute="with "double quotes""></div>) + with_double_quotes = phlex { div(attribute: 'with "double quotes"') } + assert_equal with_double_quotes, %(<div attribute="with "double quotes""></div>) end test "_, Symbol" do - expect( - phlex { div(attribute: :"") }, - ) == %(<div attribute=""></div>) + empty_symbol = phlex { div(attribute: :"") } + assert_equal empty_symbol, %(<div attribute=""></div>) - expect( - phlex { div(attribute: :test) }, - ) == %(<div attribute="test"></div>) + simple_symbol = phlex { div(attribute: :test) } + assert_equal simple_symbol, %(<div attribute="test"></div>) - expect( - phlex { div(attribute: :with_underscores) }, - ) == %(<div attribute="with-underscores"></div>) + symbol_with_underscores = phlex { div(attribute: :with_underscores) } + assert_equal symbol_with_underscores, %(<div attribute="with-underscores"></div>) - expect( - phlex { div(attribute: :"with-dashes") }, - ) == %(<div attribute="with-dashes"></div>) + symbol_with_dashes = phlex { div(attribute: :"with-dashes") } + assert_equal symbol_with_dashes, %(<div attribute="with-dashes"></div>) - expect( - phlex { div(attribute: :"with spaces") }, - ) == %(<div attribute="with spaces"></div>) + symbol_with_spaces = phlex { div(attribute: :"with spaces") } + assert_equal symbol_with_spaces, %(<div attribute="with spaces"></div>) - expect( - phlex { div(attribute: :"with 'single quotes'") }, - ) == %(<div attribute="with 'single quotes'"></div>) + symbol_with_single_quotes = phlex { div(attribute: :"with 'single quotes'") } + assert_equal symbol_with_single_quotes, %(<div attribute="with 'single quotes'"></div>) - expect( - phlex { div(attribute: :"with <html>") }, - ) == %(<div attribute="with <html>"></div>) + symbol_with_html = phlex { div(attribute: :"with <html>") } + assert_equal symbol_with_html, %(<div attribute="with <html>"></div>) - expect( - phlex { div(attribute: :'with "double quotes"') }, - ) == %(<div attribute="with "double quotes""></div>) + symbol_with_double_quotes = phlex { div(attribute: :'with "double quotes"') } + assert_equal symbol_with_double_quotes, %(<div attribute="with "double quotes""></div>) end test "_, Integer" do - expect( - phlex { div(attribute: 0) }, - ) == %(<div attribute="0"></div>) + output = phlex { div(attribute: 0) } + assert_equal output, %(<div attribute="0"></div>) - expect( - phlex { div(attribute: 42) }, - ) == %(<div attribute="42"></div>) + output = phlex { div(attribute: 42) } + assert_equal output, %(<div attribute="42"></div>) end test "_, Float" do - expect( - phlex { div(attribute: 0.0) }, - ) == %(<div attribute="0.0"></div>) + output = phlex { div(attribute: 0.0) } + assert_equal output, %(<div attribute="0.0"></div>) - expect( - phlex { div(attribute: 42.0) }, - ) == %(<div attribute="42.0"></div>) + output = phlex { div(attribute: 42.0) } + assert_equal output, %(<div attribute="42.0"></div>) - expect( - phlex { div(attribute: 1.234) }, - ) == %(<div attribute="1.234"></div>) + output = phlex { div(attribute: 1.234) } + assert_equal output, %(<div attribute="1.234"></div>) end test "_, *invalid*" do - expect { + assert_raises(Phlex::ArgumentError) do phlex { div(attribute: Object.new) } - }.to_raise(Phlex::ArgumentError) + end end test "_, Array" do - expect( - phlex { div(attribute: []) }, - ) == %(<div attribute=""></div>) + output = phlex { div(attribute: []) } + assert_equal output, %(<div attribute=""></div>) end test "_, Array(nil)" do - expect( - phlex { div(attribute: [nil, nil, nil]) }, - ) == %(<div attribute=""></div>) + output = phlex { div(attribute: [nil, nil, nil]) } + assert_equal output, %(<div attribute=""></div>) end test "_, Array(String)" do - expect( - phlex { div(attribute: ["Hello", "World"]) }, - ) == %(<div attribute="Hello World"></div>) + output = phlex { div(attribute: ["Hello", "World"]) } + assert_equal output, %(<div attribute="Hello World"></div>) - expect( - phlex { div(attribute: ["with_underscores", "with-dashes", "with spaces"]) }, - ) == %(<div attribute="with_underscores with-dashes with spaces"></div>) + output = phlex { div(attribute: ["with_underscores", "with-dashes", "with spaces"]) } + assert_equal output, %(<div attribute="with_underscores with-dashes with spaces"></div>) - expect( - phlex { div(attribute: ["with 'single quotes'", 'with "double quotes"']) }, - ) == %(<div attribute="with 'single quotes' with "double quotes""></div>) + output = phlex { div(attribute: ["with 'single quotes'", 'with "double quotes"']) } + assert_equal output, %(<div attribute="with 'single quotes' with "double quotes""></div>) end test "_, Array(Symbol)" do - expect( - phlex { div(attribute: [:hello, :world]) }, - ) == %(<div attribute="hello world"></div>) + output = phlex { div(attribute: [:hello, :world]) } + assert_equal output, %(<div attribute="hello world"></div>) - expect( - phlex { div(attribute: [:with_underscores, :"with-dashes", :"with spaces"]) }, - ) == %(<div attribute="with-underscores with-dashes with spaces"></div>) + output = phlex { div(attribute: [:with_underscores, :"with-dashes", :"with spaces"]) } + assert_equal output, %(<div attribute="with-underscores with-dashes with spaces"></div>) - expect( - phlex { div(attribute: [:with, :"single quotes", :'"double quotes"']) }, - ) == %(<div attribute="with single quotes "double quotes""></div>) + output = phlex { div(attribute: [:with, :"'single quotes'", :'"double quotes"']) } + assert_equal output, %(<div attribute="with 'single quotes' "double quotes""></div>) end test "_, Array(Integer)" do - expect( - phlex { div(attribute: [0, 42]) }, - ) == %(<div attribute="0 42"></div>) + output = phlex { div(attribute: [0, 42]) } + assert_equal output, %(<div attribute="0 42"></div>) end test "_, Array(Float)" do - expect( - phlex { div(attribute: [0.0, 42.0, 1.234]) }, - ) == %(<div attribute="0.0 42.0 1.234"></div>) + output = phlex { div(attribute: [0.0, 42.0, 1.234]) } + assert_equal output, %(<div attribute="0.0 42.0 1.234"></div>) end test "_, Array(Phlex::SGML::SafeObject)" do - expect( - phlex { div(attribute: [Phlex::SGML::SafeValue.new("Hello")]) }, - ) == %(<div attribute="Hello"></div>) + output = phlex { div(attribute: [Phlex::SGML::SafeValue.new("Hello")]) } + assert_equal output, %(<div attribute="Hello"></div>) end test "_, Array(String | Array)" do - expect( - phlex { div(attribute: ["hello", ["world"]]) }, - ) == %(<div attribute="hello world"></div>) + output = phlex { div(attribute: ["hello", ["world"]]) } + assert_equal output, %(<div attribute="hello world"></div>) end test "_, Array(Array | String)" do - expect( - phlex { div(attribute: [["hello"], "world"]) }, - ) == %(<div attribute="hello world"></div>) + output = phlex { div(attribute: [["hello"], "world"]) } + assert_equal output, %(<div attribute="hello world"></div>) end test "_, Array(String | EmptyArray)" do - expect( - phlex { div(attribute: ["hello", []]) }, - ) == %(<div attribute="hello"></div>) + output = phlex { div(attribute: ["hello", []]) } + assert_equal output, %(<div attribute="hello"></div>) end test "_, Array(*invalid*)" do - expect { + assert_raises(Phlex::ArgumentError) do phlex { div(attribute: [Object.new]) } - }.to_raise(Phlex::ArgumentError) + end end test "_, Hash(Symbol, _)" do - expect( - phlex { div(attribute: { a_b_c: "world" }) }, - ) == %(<div attribute-a-b-c="world"></div>) + output = phlex { div(attribute: { a_b_c: "world" }) } + assert_equal output, %(<div attribute-a-b-c="world"></div>) - expect { phlex { div(attribute: { :'"' => "a" }) } }.to_raise(Phlex::ArgumentError) - expect { phlex { div(attribute: { :"'" => "a" }) } }.to_raise(Phlex::ArgumentError) - expect { phlex { div(attribute: { :"&" => "a" }) } }.to_raise(Phlex::ArgumentError) - expect { phlex { div(attribute: { :"<" => "a" }) } }.to_raise(Phlex::ArgumentError) - expect { phlex { div(attribute: { :">" => "a" }) } }.to_raise(Phlex::ArgumentError) + assert_raises(Phlex::ArgumentError) { phlex { div(attribute: { :'"' => "a" }) } } + assert_raises(Phlex::ArgumentError) { phlex { div(attribute: { :"'" => "a" }) } } + assert_raises(Phlex::ArgumentError) { phlex { div(attribute: { :"&" => "a" }) } } + assert_raises(Phlex::ArgumentError) { phlex { div(attribute: { :"<" => "a" }) } } + assert_raises(Phlex::ArgumentError) { phlex { div(attribute: { :">" => "a" }) } } end test "_, Hash(String, _)" do - expect( - phlex { div(attribute: { "a_b_c" => "world" }) }, - ) == %(<div attribute-a_b_c="world"></div>) + output = phlex { div(attribute: { "a_b_c" => "world" }) } + assert_equal output, %(<div attribute-a_b_c="world"></div>) - expect { phlex { div(attribute: { '"' => "a" }) } }.to_raise(Phlex::ArgumentError) - expect { phlex { div(attribute: { "'" => "a" }) } }.to_raise(Phlex::ArgumentError) - expect { phlex { div(attribute: { "&" => "a" }) } }.to_raise(Phlex::ArgumentError) - expect { phlex { div(attribute: { "<" => "a" }) } }.to_raise(Phlex::ArgumentError) - expect { phlex { div(attribute: { ">" => "a" }) } }.to_raise(Phlex::ArgumentError) + assert_raises(Phlex::ArgumentError) { phlex { div(attribute: { '"' => "a" }) } } + assert_raises(Phlex::ArgumentError) { phlex { div(attribute: { "'" => "a" }) } } + assert_raises(Phlex::ArgumentError) { phlex { div(attribute: { "&" => "a" }) } } + assert_raises(Phlex::ArgumentError) { phlex { div(attribute: { "<" => "a" }) } } + assert_raises(Phlex::ArgumentError) { phlex { div(attribute: { ">" => "a" }) } } end test "_, Hash(*invalid*, _)" do - expect { phlex { div(attribute: { Object.new => "a" }) } }.to_raise(Phlex::ArgumentError) + assert_raises(Phlex::ArgumentError) { phlex { div(attribute: { Object.new => "a" }) } } end test "_, Hash(_, String)" do - expect( - phlex { div(data: { controller: "with_underscores" }) }, - ) == %(<div data-controller="with_underscores"></div>) + with_underscores = phlex { div(data: { controller: "with_underscores" }) } + assert_equal with_underscores, %(<div data-controller="with_underscores"></div>) - expect( - phlex { div(data: { controller: "with-dashes" }) }, - ) == %(<div data-controller="with-dashes"></div>) + with_dashes = phlex { div(data: { controller: "with-dashes" }) } + assert_equal with_dashes, %(<div data-controller="with-dashes"></div>) - expect( - phlex { div(data: { controller: "with spaces" }) }, - ) == %(<div data-controller="with spaces"></div>) + with_spaces = phlex { div(data: { controller: "with spaces" }) } + assert_equal with_spaces, %(<div data-controller="with spaces"></div>) - expect( - phlex { div(data: { controller: "with 'single quotes'" }) }, - ) == %(<div data-controller="with 'single quotes'"></div>) + with_single_quotes = phlex { div(data: { controller: "with 'single quotes'" }) } + assert_equal with_single_quotes, %(<div data-controller="with 'single quotes'"></div>) - expect( - phlex { div(data: { controller: "with <html>" }) }, - ) == %(<div data-controller="with <html>"></div>) + with_html = phlex { div(data: { controller: "with <html>" }) } + assert_equal with_html, %(<div data-controller="with <html>"></div>) - expect( - phlex { div(data: { controller: 'with "double quotes"' }) }, - ) == %(<div data-controller="with "double quotes""></div>) + with_double_quotes = phlex { div(data: { controller: 'with "double quotes"' }) } + assert_equal with_double_quotes, %(<div data-controller="with "double quotes""></div>) end test "_, Hash(_, Symbol)" do - expect( - phlex { div(data: { controller: :with_underscores }) }, - ) == %(<div data-controller="with-underscores"></div>) + output = phlex { div(data: { controller: :with_underscores }) } + assert_equal output, %(<div data-controller="with-underscores"></div>) - expect( - phlex { div(data: { controller: :"with-dashes" }) }, - ) == %(<div data-controller="with-dashes"></div>) + output = phlex { div(data: { controller: :"with-dashes" }) } + assert_equal output, %(<div data-controller="with-dashes"></div>) - expect( - phlex { div(data: { controller: :"with spaces" }) }, - ) == %(<div data-controller="with spaces"></div>) + output = phlex { div(data: { controller: :"with spaces" }) } + assert_equal output, %(<div data-controller="with spaces"></div>) - expect( - phlex { div(data: { controller: :"with 'single quotes'" }) }, - ) == %(<div data-controller="with 'single quotes'"></div>) + output = phlex { div(data: { controller: :"with 'single quotes'" }) } + assert_equal output, %(<div data-controller="with 'single quotes'"></div>) - expect( - phlex { div(data: { controller: :"with <html>" }) }, - ) == %(<div data-controller="with <html>"></div>) + output = phlex { div(data: { controller: :"with <html>" }) } + assert_equal output, %(<div data-controller="with <html>"></div>) - expect( - phlex { div(data: { controller: :'with "double quotes"' }) }, - ) == %(<div data-controller="with "double quotes""></div>) + output = phlex { div(data: { controller: :'with "double quotes"' }) } + assert_equal output, %(<div data-controller="with "double quotes""></div>) end test "_, Hash(_, Integer)" do - expect( - phlex { div(data: { controller: 42 }) }, - ) == %(<div data-controller="42"></div>) + output = phlex { div(data: { controller: 42 }) } + assert_equal output, %(<div data-controller="42"></div>) - expect( - phlex { div(data: { controller: 1_234 }) }, - ) == %(<div data-controller="1234"></div>) + output = phlex { div(data: { controller: 1_234 }) } + assert_equal output, %(<div data-controller="1234"></div>) - expect( - phlex { div(data: { controller: 0 }) }, - ) == %(<div data-controller="0"></div>) + output = phlex { div(data: { controller: 0 }) } + assert_equal output, %(<div data-controller="0"></div>) end test "_, Hash(_, Float)" do - expect( - phlex { div(data: { controller: 42.0 }) }, - ) == %(<div data-controller="42.0"></div>) + output = phlex { div(data: { controller: 42.0 }) } + assert_equal output, %(<div data-controller="42.0"></div>) - expect( - phlex { div(data: { controller: 1.234 }) }, - ) == %(<div data-controller="1.234"></div>) + output = phlex { div(data: { controller: 1.234 }) } + assert_equal output, %(<div data-controller="1.234"></div>) - expect( - phlex { div(data: { controller: 0.0 }) }, - ) == %(<div data-controller="0.0"></div>) + output = phlex { div(data: { controller: 0.0 }) } + assert_equal output, %(<div data-controller="0.0"></div>) end test "_, Hash(_, Array)" do - expect( - phlex { div(data: { controller: [1, 2, 3] }) }, - ) == %(<div data-controller="1 2 3"></div>) + output = phlex { div(data: { controller: [1, 2, 3] }) } + assert_equal output, %(<div data-controller="1 2 3"></div>) end test "_, Hash(_, Set)" do - expect( - phlex { div(data: { controller: Set[1, 2, 3] }) }, - ) == %(<div data-controller="1 2 3"></div>) + output = phlex { div(data: { controller: Set[1, 2, 3] }) } + assert_equal output, %(<div data-controller="1 2 3"></div>) end test "_, Hash(_, Hash)" do - expect( - phlex { div(data: { controller: { hello: "world" } }) }, - ) == %(<div data-controller-hello="world"></div>) + output = phlex { div(data: { controller: { hello: "world" } }) } + assert_equal output, %(<div data-controller-hello="world"></div>) end test "_, Hash(_, Phlex::SGML::SafeObject)" do - expect( - phlex { div(data: { controller: Phlex::SGML::SafeValue.new("Hello") }) }, - ) == %(<div data-controller="Hello"></div>) + output = phlex { div(data: { controller: Phlex::SGML::SafeValue.new("Hello") }) } + assert_equal output, %(<div data-controller="Hello"></div>) end test "_, Hash(_, false)" do - expect( - phlex { div(data: { controller: false }) }, - ) == %(<div></div>) + output = phlex { div(data: { controller: false }) } + assert_equal output, %(<div></div>) end test "_, Hash(_, nil)" do - expect( - phlex { div(data: { controller: nil }) }, - ) == %(<div></div>) + output = phlex { div(data: { controller: nil }) } + assert_equal output, %(<div></div>) end test "_, Hash(_, *invalid*)" do - expect { + assert_raises(Phlex::ArgumentError) do phlex { div(data: { controller: Object.new }) } - }.to_raise(Phlex::ArgumentError) + end end test "_, Set(nil)" do - expect( - phlex { div(attribute: Set[nil, nil, nil]) }, - ) == %(<div attribute=""></div>) + output = phlex { div(attribute: Set[nil, nil, nil]) } + assert_equal output, %(<div attribute=""></div>) end test "_, Set(String)" do - expect( - phlex { div(attribute: Set["Hello", "World"]) }, - ) == %(<div attribute="Hello World"></div>) + output = phlex { div(attribute: Set["Hello", "World"]) } + assert_equal output, %(<div attribute="Hello World"></div>) - expect( - phlex { div(attribute: Set["with_underscores", "with-dashes", "with spaces"]) }, - ) == %(<div attribute="with_underscores with-dashes with spaces"></div>) + output = phlex { div(attribute: Set["with_underscores", "with-dashes", "with spaces"]) } + assert_equal output, %(<div attribute="with_underscores with-dashes with spaces"></div>) - expect( - phlex { div(attribute: Set["with 'single quotes'", 'with "double quotes"']) }, - ) == %(<div attribute="with 'single quotes' with "double quotes""></div>) + output = phlex { div(attribute: Set["with 'single quotes'", 'with "double quotes"']) } + assert_equal output, %(<div attribute="with 'single quotes' with "double quotes""></div>) end test "_, Set(Symbol)" do - expect( - phlex { div(attribute: Set[:hello, :world]) }, - ) == %(<div attribute="hello world"></div>) + output = phlex { div(attribute: Set[:hello, :world]) } + assert_equal output, %(<div attribute="hello world"></div>) - expect( - phlex { div(attribute: Set[:with_underscores, :"with-dashes", :"with spaces"]) }, - ) == %(<div attribute="with-underscores with-dashes with spaces"></div>) + output = phlex { div(attribute: Set[:with_underscores, :"with-dashes", :"with spaces"]) } + assert_equal output, %(<div attribute="with-underscores with-dashes with spaces"></div>) - expect( - phlex { div(attribute: Set[:with, :"single quotes", :'"double quotes"']) }, - ) == %(<div attribute="with single quotes "double quotes""></div>) + output = phlex { div(attribute: Set[:with, :"single quotes", :'"double quotes"']) } + assert_equal output, %(<div attribute="with single quotes "double quotes""></div>) end test "_, Set(Integer)" do - expect( - phlex { div(attribute: Set[0, 42]) }, - ) == %(<div attribute="0 42"></div>) + output = phlex { div(attribute: Set[0, 42]) } + assert_equal output, %(<div attribute="0 42"></div>) end test "_, Set(Float)" do - expect( - phlex { div(attribute: Set[0.0, 42.0, 1.234]) }, - ) == %(<div attribute="0.0 42.0 1.234"></div>) + output = phlex { div(attribute: Set[0.0, 42.0, 1.234]) } + assert_equal output, %(<div attribute="0.0 42.0 1.234"></div>) end test "_, Set(Phlex::SGML::SafeObject)" do - expect( - phlex { - div(attribute: Set[ - Phlex::SGML::SafeValue.new("Hello"), - ]) - }, - ) == %(<div attribute="Hello"></div>) + output = phlex do + div(attribute: Set[Phlex::SGML::SafeValue.new("Hello")]) + end + + assert_equal output, %(<div attribute="Hello"></div>) end test "_, Set(*invalid*)" do - expect { + assert_raises(Phlex::ArgumentError) do phlex { div(attribute: Set[Object.new]) } - }.to_raise(Phlex::ArgumentError) + end end test ":style, Array(nil)" do - expect( - phlex { div(style: [nil, nil, nil]) }, - ) == %(<div style=""></div>) + output = phlex { div(style: [nil, nil, nil]) } + assert_equal output, %(<div style=""></div>) end test ":style, Array(Symbol)" do - expect { + assert_raises(Phlex::ArgumentError) do phlex { div(style: [:color_blue]) } - }.to_raise(Phlex::ArgumentError) + end end test ":style, Array(String)" do - expect( - phlex { div(style: ["color: blue;", "font-weight: bold"]) }, - ) == %(<div style="color: blue; font-weight: bold;"></div>) + output = phlex { div(style: ["color: blue;", "font-weight: bold"]) } + assert_equal output, %(<div style="color: blue; font-weight: bold;"></div>) - expect( - phlex { div(style: ["font-family: 'MonoLisa'"]) }, - ) == %(<div style="font-family: 'MonoLisa';"></div>) + output = phlex { div(style: ["font-family: 'MonoLisa'"]) } + assert_equal output, %(<div style="font-family: 'MonoLisa';"></div>) - expect( - phlex { div(style: ['font-family: "MonoLisa"']) }, - ) == %(<div style="font-family: "MonoLisa";"></div>) + output = phlex { div(style: ['font-family: "MonoLisa"']) } + assert_equal output, %(<div style="font-family: "MonoLisa";"></div>) end test ":style, Array(Phlex::SGML::SafeObject)" do - expect( - phlex { div(style: [Phlex::SGML::SafeValue.new("color: blue")]) }, - ) == %(<div style="color: blue;"></div>) + output = phlex { div(style: [Phlex::SGML::SafeValue.new("color: blue")]) } + assert_equal output, %(<div style="color: blue;"></div>) - expect( - phlex { div(style: [Phlex::SGML::SafeValue.new("font-weight: bold;")]) }, - ) == %(<div style="font-weight: bold;"></div>) + output = phlex { div(style: [Phlex::SGML::SafeValue.new("font-weight: bold;")]) } + assert_equal output, %(<div style="font-weight: bold;"></div>) end test ":style, Array(Hash)" do - expect( - phlex { div(style: [{ color: "blue" }, { font_weight: "bold", line_height: 1.5 }]) }, - ) == %(<div style="color: blue; font-weight: bold; line-height: 1.5;"></div>) + output = phlex { div(style: [{ color: "blue" }, { font_weight: "bold", line_height: 1.5 }]) } + assert_equal output, %(<div style="color: blue; font-weight: bold; line-height: 1.5;"></div>) end test ":style, Set(nil)" do - expect( - phlex { div(style: Set[nil]) }, - ) == %(<div style=""></div>) + output = phlex { div(style: Set[nil]) } + assert_equal output, %(<div style=""></div>) end test ":style, Set(String)" do - expect( - phlex { div(style: Set["color: blue"]) }, - ) == %(<div style="color: blue;"></div>) + output = phlex { div(style: Set["color: blue"]) } + assert_equal output, %(<div style="color: blue;"></div>) end test ":style, Hash(Symbol, String)" do - expect( - phlex { div(style: { color: "blue", font_weight: "bold" }) }, - ) == %(<div style="color: blue; font-weight: bold;"></div>) + output = phlex { div(style: { color: "blue", font_weight: "bold" }) } + assert_equal output, %(<div style="color: blue; font-weight: bold;"></div>) end test ":style, Hash(Symbol, Integer)" do - expect( - phlex { div(style: { line_height: 2 }) }, - ) == %(<div style="line-height: 2;"></div>) + output = phlex { div(style: { line_height: 2 }) } + assert_equal output, %(<div style="line-height: 2;"></div>) end test ":style, Hash(Symbol, Float)" do - expect( - phlex { div(style: { line_height: 1.5 }) }, - ) == %(<div style="line-height: 1.5;"></div>) + output = phlex { div(style: { line_height: 1.5 }) } + assert_equal output, %(<div style="line-height: 1.5;"></div>) end test ":style, Hash(Symbol, Symbol)" do - expect( - phlex { div(style: { flex_direction: :column_reverse }) }, - ) == %(<div style="flex-direction: column-reverse;"></div>) + output = phlex { div(style: { flex_direction: :column_reverse }) } + assert_equal output, %(<div style="flex-direction: column-reverse;"></div>) - expect( - phlex { div(style: { flex_direction: :'"double quotes"' }) }, - ) == %(<div style="flex-direction: "double quotes";"></div>) + output = phlex { div(style: { flex_direction: :'"double quotes"' }) } + assert_equal output, %(<div style="flex-direction: "double quotes";"></div>) end test ":style, Hash(Symbol, Phlex::SGML::SafeObject)" do - expect( - phlex { div(style: { color: Phlex::SGML::SafeValue.new("blue") }) }, - ) == %(<div style="color: blue;"></div>) + output = phlex { div(style: { color: Phlex::SGML::SafeValue.new("blue") }) } + assert_equal output, %(<div style="color: blue;"></div>) end test ":style, Hash(Symbol, nil)" do - expect( - phlex { div(style: { color: nil }) }, - ) == %(<div style=""></div>) + output = phlex { div(style: { color: nil }) } + assert_equal output, %(<div style=""></div>) end test ":style, Hash(Symbol, *invalid*)" do - expect { + assert_raises(Phlex::ArgumentError) do phlex { div(style: { color: Object.new }) } - }.to_raise(Phlex::ArgumentError) + end end test ":style, Hash(String, String)" do - expect( - phlex { div(style: { "color" => "blue" }) }, - ) == %(<div style="color: blue;"></div>) + output = phlex { div(style: { "color" => "blue" }) } + assert_equal output, %(<div style="color: blue;"></div>) end test ":style, Hash(*invalid*, String)" do - expect { + assert_raises(Phlex::ArgumentError) do phlex { div(style: { Object.new => "blue" }) } - }.to_raise(Phlex::ArgumentError) + end end # This is just for coverage. diff --git a/quickdraw/sgml/callbacks.test.rb b/quickdraw/sgml/callbacks.test.rb index c21b708b..18efb6b1 100644 --- a/quickdraw/sgml/callbacks.test.rb +++ b/quickdraw/sgml/callbacks.test.rb @@ -27,5 +27,5 @@ def view_template end test "callbacks are called in the correct order" do - expect(Example.call) == ("<i>1</i><i>2</i><i>3</i><i>4</i><i>5</i><i>6</i><i>7</i>") + assert_equal Example.call, "<i>1</i><i>2</i><i>3</i><i>4</i><i>5</i><i>6</i><i>7</i>" end diff --git a/quickdraw/sgml/capture.test.rb b/quickdraw/sgml/capture.test.rb index ed4469a0..1d465d6a 100644 --- a/quickdraw/sgml/capture.test.rb +++ b/quickdraw/sgml/capture.test.rb @@ -11,5 +11,5 @@ def view_template(&block) "#{a} #{b} #{c}" end - expect(output) == "<h1>a b c</h1>" + assert_equal output, "<h1>a b c</h1>" end diff --git a/quickdraw/sgml/comment.test.rb b/quickdraw/sgml/comment.test.rb index b617e9eb..9c898b66 100644 --- a/quickdraw/sgml/comment.test.rb +++ b/quickdraw/sgml/comment.test.rb @@ -5,19 +5,19 @@ include SGMLHelper test "text comment" do - expect( - phlex { - comment { "Hello World" } - }, - ) == %(<!-- Hello World -->) + output = phlex do + comment { "Hello World" } + end + + assert_equal output, "<!-- Hello World -->" end test "block comment with markup" do - expect( - phlex { - comment { - h1 { "Hello World" } - } - }, - ) == %(<!-- <h1>Hello World</h1> -->) + output = phlex do + comment do + h1 { "Hello World" } + end + end + + assert_equal output, "<!-- <h1>Hello World</h1> -->" end diff --git a/quickdraw/sgml/conditional_rendering.test.rb b/quickdraw/sgml/conditional_rendering.test.rb index 21437e39..3d7c9851 100644 --- a/quickdraw/sgml/conditional_rendering.test.rb +++ b/quickdraw/sgml/conditional_rendering.test.rb @@ -13,6 +13,6 @@ def view_template end test do - expect(Example.new(render: true).call) == "<h1>Hello</h1>" - expect(Example.new(render: false).call) == "" + assert_equal Example.new(render: true).call, "<h1>Hello</h1>" + assert_equal Example.new(render: false).call, "" end diff --git a/quickdraw/sgml/content_yielding.test.rb b/quickdraw/sgml/content_yielding.test.rb index e603ab6e..6232c994 100644 --- a/quickdraw/sgml/content_yielding.test.rb +++ b/quickdraw/sgml/content_yielding.test.rb @@ -11,7 +11,7 @@ def view_template end test "should render the test class" do - expect(TestClass.call) == %q(<select name="test"></select><input type="text" name="other">) + assert_equal TestClass.call, %q(<select name="test"></select><input type="text" name="other">) end class OtherTestClass < Phlex::HTML @@ -25,5 +25,5 @@ def view_template end test "should render the test class" do - expect(OtherTestClass.call) == %q(<ul></ul><p>hi there</p>) + assert_equal OtherTestClass.call, %q(<ul></ul><p>hi there</p>) end diff --git a/quickdraw/sgml/plain.test.rb b/quickdraw/sgml/plain.test.rb index a200e9b8..d7a015e5 100644 --- a/quickdraw/sgml/plain.test.rb +++ b/quickdraw/sgml/plain.test.rb @@ -5,35 +5,32 @@ include SGMLHelper test "with string" do - expect( - phlex { plain "Hello, World!" }, - ) == "Hello, World!" + output = phlex { plain "Hello, World!" } + assert_equal output, "Hello, World!" end test "with symbol" do - expect( - phlex { plain :hello_world }, - ) == "hello_world" + output = phlex { plain :hello_world } + assert_equal output, "hello_world" end test "with integer" do - expect( - phlex { plain 42 }, - ) == "42" + output = phlex { plain 42 } + assert_equal output, "42" end test "with float" do - expect( - phlex { plain 3.14 }, - ) == "3.14" + output = phlex { plain 3.14 } + assert_equal output, "3.14" end test "with nil" do - expect( - phlex { plain nil }, - ) == "" + output = phlex { plain nil } + assert_equal output, "" end test "with invalid arguments" do - expect { phlex { plain [] } }.to_raise(Phlex::ArgumentError) + assert_raises(Phlex::ArgumentError) do + phlex { plain [] } + end end diff --git a/quickdraw/sgml/raw.test.rb b/quickdraw/sgml/raw.test.rb index c633f621..62dd095b 100644 --- a/quickdraw/sgml/raw.test.rb +++ b/quickdraw/sgml/raw.test.rb @@ -5,19 +5,24 @@ include SGMLHelper test "with an unsafe object" do - expect { phlex { raw "<div></div>" } }.to_raise(Phlex::ArgumentError) do |error| - expect(error.message) == "You passed an unsafe object to `raw`." + error = assert_raises(Phlex::ArgumentError) do + phlex { raw "<div></div>" } end + + assert_equal error.message, "You passed an unsafe object to `raw`." end test "with a safe object" do - expect(phlex { raw safe %(<div class="hello">&</div>) }) == %(<div class="hello">&</div>) + output = phlex { raw safe %(<div class="hello">&</div>) } + assert_equal output, %(<div class="hello">&</div>) end test "with nil" do - expect(phlex { div { raw nil } }) == %(<div></div>) + output = phlex { div { raw nil } } + assert_equal output, "<div></div>" end test "with empty string" do - expect(phlex { div { raw "" } }) == %(<div></div>) + output = phlex { div { raw "" } } + assert_equal output, "<div></div>" end diff --git a/quickdraw/sgml/safe.test.rb b/quickdraw/sgml/safe.test.rb index f3a622a2..76c1e000 100644 --- a/quickdraw/sgml/safe.test.rb +++ b/quickdraw/sgml/safe.test.rb @@ -5,32 +5,30 @@ include SGMLHelper test "safe attribute values" do - expect( - phlex { - a( - onclick: safe("window.history.back()"), - href: safe("javascript:window.history.back()"), - ) - }, - ) == %(<a onclick="window.history.back()" href="javascript:window.history.back()"></a>) + output = phlex do + a( + onclick: safe("window.history.back()"), + href: safe("javascript:window.history.back()"), + ) + end + + assert_equal output, %(<a onclick="window.history.back()" href="javascript:window.history.back()"></a>) end test "element content blocks that return safe values" do - expect( - phlex { - script { - safe(%(console.log("Hello World");)) - } - }, - ) == %(<script>console.log("Hello World");</script>) + output = phlex do + script { + safe(%(console.log("Hello World");)) + } + end + + assert_equal output, %(<script>console.log("Hello World");</script>) end test "with invalid input" do - expect { - phlex { - script { safe(123) } - } - }.to_raise(Phlex::ArgumentError) do |error| - expect(error.message) == "Expected a String." + error = assert_raises(Phlex::ArgumentError) do + phlex { script { safe(123) } } end + + assert_equal error.message, "Expected a String." end diff --git a/quickdraw/sgml/selective_rendering.test.rb b/quickdraw/sgml/selective_rendering.test.rb index 8ff2a6ca..9427d8e6 100644 --- a/quickdraw/sgml/selective_rendering.test.rb +++ b/quickdraw/sgml/selective_rendering.test.rb @@ -66,44 +66,39 @@ def view_template end test "renders the just the target fragment" do - expect( - StandardElementExample.new.call(fragments: ["target"]), - ) == %(<h1 id="target">Hello<strong>World</strong><img src="image.jpg"></h1>) + output = StandardElementExample.new.call(fragments: ["target"]) + assert_equal output, %(<h1 id="target">Hello<strong>World</strong><img src="image.jpg"></h1>) end test "works with void elements" do - expect( - VoidElementExample.new.call(fragments: ["target"]), - ) == %(<img id="target" src="image.jpg">) + output = VoidElementExample.new.call(fragments: ["target"]) + assert_equal output, %(<img id="target" src="image.jpg">) end test "supports multiple fragments" do - expect( - StandardElementExample.new.call(fragments: ["target", "image"]), - ) == %(<h1 id="target">Hello<strong>World</strong><img src="image.jpg"></h1><img id="image" src="after.jpg">) + output = StandardElementExample.new.call(fragments: ["target", "image"]) + assert_equal output, %(<h1 id="target">Hello<strong>World</strong><img src="image.jpg"></h1><img id="image" src="after.jpg">) end test "halts early after all fragments are found" do called = false checker = -> { called = true } StandardElementExample.new(checker).call(fragments: ["target"]) - expect(called) == false + + refute called end test "with a capture block doesn't render the capture block" do - expect( - WithCaptureBlock.new.call(fragments: ["after"]), - ) == %(<h1 id="after">After</h1>) + output = WithCaptureBlock.new.call(fragments: ["after"]) + assert_equal output, %(<h1 id="after">After</h1>) end test "with a capture block renders the capture block when selected" do - expect( - WithCaptureBlock.new.call(fragments: ["around"]), - ) == %(<div id="around"><h1 id="inside">Inside</h1></div>) + output = WithCaptureBlock.new.call(fragments: ["around"]) + assert_equal output, %(<div id="around"><h1 id="inside">Inside</h1></div>) end test "with a capture block doesn't select from the capture block" do - expect( - WithCaptureBlock.new.call(fragments: ["inside"]), - ) == "" + output = WithCaptureBlock.new.call(fragments: ["inside"]) + assert_equal output, "" end diff --git a/quickdraw/sgml/to_proc.test.rb b/quickdraw/sgml/to_proc.test.rb index 2e40aadf..2b185518 100644 --- a/quickdraw/sgml/to_proc.test.rb +++ b/quickdraw/sgml/to_proc.test.rb @@ -20,11 +20,11 @@ def view_template end test "rendering components via #to_proc" do - expect( - phlex { - render Example do |e| - e.slot(&Sub.new) - end - }, - ) == "<article><h1>Sub</h1></article>" + output = phlex do + render Example do |e| + e.slot(&Sub.new) + end + end + + assert_equal output, %(<article><h1>Sub</h1></article>) end diff --git a/quickdraw/sgml/whitespace.test.rb b/quickdraw/sgml/whitespace.test.rb index cdcfdd37..f7a8dee5 100644 --- a/quickdraw/sgml/whitespace.test.rb +++ b/quickdraw/sgml/whitespace.test.rb @@ -5,21 +5,21 @@ include SGMLHelper test "whitespae between" do - expect( - phlex { - div - whitespace - div - }, - ) == %(<div></div> <div></div>) + output = phlex do + div + whitespace + div + end + + assert_equal output, %(<div></div> <div></div>) end test "whitespae around" do - expect( - phlex { - div - whitespace { div } - div - }, - ) == %(<div></div> <div></div> <div></div>) + output = phlex do + div + whitespace { div } + div + end + + assert_equal output, %(<div></div> <div></div> <div></div>) end diff --git a/quickdraw/svg.test.rb b/quickdraw/svg.test.rb index 954c1705..756c76b2 100644 --- a/quickdraw/svg.test.rb +++ b/quickdraw/svg.test.rb @@ -9,10 +9,10 @@ def view_template end test do - expect(Example.call) == %(<svg><path d="123"></path></svg>) + assert_equal Example.call, %(<svg><path d="123"></path></svg>) end test "content_type" do component = Class.new(Phlex::SVG) - expect(component.new.content_type) == "image/svg+xml" + assert_equal component.new.content_type, "image/svg+xml" end diff --git a/quickdraw/svg/standard_elements.test.rb b/quickdraw/svg/standard_elements.test.rb index 77d6cef2..57276e84 100644 --- a/quickdraw/svg/standard_elements.test.rb +++ b/quickdraw/svg/standard_elements.test.rb @@ -8,7 +8,7 @@ end end - expect(example.call) == %(<#{tag} class="class" id="id" disabled>content</#{tag}>) + assert_equal example.call, %(<#{tag} class="class" id="id" disabled>content</#{tag}>) end test "<#{tag}> with string attribute keys" do @@ -18,7 +18,7 @@ end end - expect(example.call) == %(<#{tag} attribute_with_underscore>content</#{tag}>) + assert_equal example.call, %(<#{tag} attribute_with_underscore>content</#{tag}>) end test "<#{tag}> with hash attribute values" do @@ -28,6 +28,6 @@ end end - expect(example.call) == %(<#{tag} aria-hidden data-turbo-frame="_top">content</#{tag}>) + assert_equal example.call, %(<#{tag} aria-hidden data-turbo-frame="_top">content</#{tag}>) end end diff --git "a/quickdraw/\360\237\222\252.test.rb" "b/quickdraw/\360\237\222\252.test.rb" index 04c89bb2..4a932c40 100644 --- "a/quickdraw/\360\237\222\252.test.rb" +++ "b/quickdraw/\360\237\222\252.test.rb" @@ -7,5 +7,5 @@ def view_template end test "💪" do - expect(Example.new.call) == %(<h1>💪</h1>) + assert_equal Example.new.call, %(<h1>💪</h1>) end