diff options
-rw-r--r-- | it_html.class | 6 | ||||
-rwxr-xr-x | tests/it_html.t | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/it_html.class b/it_html.class index 9216615..db66abb 100644 --- a/it_html.class +++ b/it_html.class @@ -316,6 +316,12 @@ function img($args) } } + foreach ($args as $arg) + $havealt += isset($arg['alt']); + + if (!$havealt) + it::error('img() needs alt'); + return $this->_tag("img", $args); } diff --git a/tests/it_html.t b/tests/it_html.t index 75a8c69..8a8aed6 100755 --- a/tests/it_html.t +++ b/tests/it_html.t @@ -19,8 +19,8 @@ is( ); is( - img(array('src' => "foo.png")), - '<img src="foo.png">', + img(array('src' => "foo.png", 'alt' => "")), + '<img src="foo.png" alt="">', "empty link tag" ); |