Skip to content

Commit c2fc8c8

Browse files
add youtube component tests
1 parent 0687a9b commit c2fc8c8

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

spec/usage/components/youtube_spec.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
require_relative '../../support/utils'
2+
include Utils
3+
4+
describe 'Youtube Component', type: :feature, js: true do
5+
6+
it 'Example 1' do
7+
8+
class ExamplePage < Matestack::Ui::Page
9+
10+
def response
11+
components {
12+
# simple youtube video
13+
youtube height: 360, width: 360, yt_id: 'OY5AeGhgK7I', class: 'iframe'
14+
# youtube video with start_at and no_controls
15+
youtube height: 360, width: 360, yt_id: 'OY5AeGhgK7I', start_at: 30, no_controls: true
16+
# youtube video with start_at and privacy_mode
17+
youtube height: 360, width: 360, yt_id: 'OY5AeGhgK7I', start_at: 30, privacy_mode: true
18+
}
19+
end
20+
21+
end
22+
23+
visit '/example'
24+
25+
static_output = page.html
26+
27+
expect(page).to have_selector("iframe[src='https://www.youtube.com/embed/OY5AeGhgK7I'][class='iframe']")
28+
expect(page).to have_selector("iframe[src='https://www.youtube.com/embed/OY5AeGhgK7I?controls=0&start=30']")
29+
expect(page).to have_selector("iframe[src='https://www.youtube-nocookie.com/embed/OY5AeGhgK7I?start=30']")
30+
31+
end
32+
33+
end

0 commit comments

Comments
 (0)