summaryrefslogtreecommitdiffstats
path: root/hugolib/embedded_shortcodes_test.go
diff options
context:
space:
mode:
authorZach Bayoff <30878344+zbayoff@users.noreply.github.com>2019-10-12 12:10:14 -0400
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-10-12 18:10:14 +0200
commit7b3edc293144dd450e87ca32f238221c21eb1b47 (patch)
tree7848f4b278cc933834d754cb78a9f87d059bf188 /hugolib/embedded_shortcodes_test.go
parent65b7d4221b90445bfc089873092411cf7e322933 (diff)
tpl: Add optional "title" attribute to iframe in Vimeo shortcode
Add an optional "title" attribute to the iframe in the vimeo shortcode. If one is not given, the title attribute will default to "vimeo video". It is imperative for iframes to have a non-empty "title" attribute in order to meet WCAG2.0 accessibility guidelines https://www.w3.org/TR/WCAG20-TECHS/H64.
Diffstat (limited to 'hugolib/embedded_shortcodes_test.go')
-rw-r--r--hugolib/embedded_shortcodes_test.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/hugolib/embedded_shortcodes_test.go b/hugolib/embedded_shortcodes_test.go
index b34a767ca..64f2203e9 100644
--- a/hugolib/embedded_shortcodes_test.go
+++ b/hugolib/embedded_shortcodes_test.go
@@ -212,17 +212,27 @@ func TestShortcodeVimeo(t *testing.T) {
}{
{
`{{< vimeo 146022717 >}}`,
- "(?s)\n<div style=\".*?\">.*?<iframe src=\"https://player.vimeo.com/video/146022717\" style=\".*?\" webkitallowfullscreen mozallowfullscreen allowfullscreen>.*?</iframe>.*?</div>\n",
+ "(?s)\n<div style=\".*?\">.*?<iframe src=\"https://player.vimeo.com/video/146022717\" style=\".*?\" title=\"vimeo video\" webkitallowfullscreen mozallowfullscreen allowfullscreen>.*?</iframe>.*?</div>\n",
},
// set class
{
`{{< vimeo 146022717 video >}}`,
- "(?s)\n<div class=\"video\">.*?<iframe src=\"https://player.vimeo.com/video/146022717\" webkitallowfullscreen mozallowfullscreen allowfullscreen>.*?</iframe>.*?</div>\n",
+ "(?s)\n<div class=\"video\">.*?<iframe src=\"https://player.vimeo.com/video/146022717\" title=\"vimeo video\" webkitallowfullscreen mozallowfullscreen allowfullscreen>.*?</iframe>.*?</div>\n",
+ },
+ // set vimeo title
+ {
+ `{{< vimeo 146022717 video my-title >}}`,
+ "(?s)\n<div class=\"video\">.*?<iframe src=\"https://player.vimeo.com/video/146022717\" title=\"my-title\" webkitallowfullscreen mozallowfullscreen allowfullscreen>.*?</iframe>.*?</div>\n",
},
// set class (using named params)
{
`{{< vimeo id="146022717" class="video" >}}`,
- "(?s)^<div class=\"video\">.*?<iframe src=\"https://player.vimeo.com/video/146022717\" webkitallowfullscreen mozallowfullscreen allowfullscreen>.*?</iframe>.*?</div>",
+ "(?s)^<div class=\"video\">.*?<iframe src=\"https://player.vimeo.com/video/146022717\" title=\"vimeo video\" webkitallowfullscreen mozallowfullscreen allowfullscreen>.*?</iframe>.*?</div>",
+ },
+ // set vimeo title (using named params)
+ {
+ `{{< vimeo id="146022717" class="video" title="my vimeo video" >}}`,
+ "(?s)^<div class=\"video\">.*?<iframe src=\"https://player.vimeo.com/video/146022717\" title=\"my vimeo video\" webkitallowfullscreen mozallowfullscreen allowfullscreen>.*?</iframe>.*?</div>",
},
} {
var (