Skip to content

Commit 5761c71

Browse files
authored
[rb] Add test for detached shadow root error type (#14267)
Co-authored-by: aguspe <[email protected]>
1 parent 2de94e3 commit 5761c71

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

rb/spec/integration/selenium/webdriver/shadow_root_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ module WebDriver
3838
expect { div.shadow_root }.to raise_error(Error::NoSuchShadowRootError)
3939
end
4040

41+
it 'raises error if the shadow root is detached', exclude: {browser: :safari, reason: 'NoMethodError'} do
42+
driver.navigate.to url_for('simpleTest.html')
43+
div = driver.find_element(css: 'div')
44+
driver.execute_script('arguments[0].attachShadow({ mode: "open" });', div)
45+
root = div.shadow_root
46+
driver.execute_script('arguments[0].remove();', div)
47+
expect { root.find_element(css: '#x') }.to raise_error(Error::DetachedShadowRootError)
48+
end
49+
4150
it 'gets shadow root from script',
4251
exclude: {browser: :safari, reason: 'returns correct node, but references shadow root as a element'} do
4352
shadow_root = custom_element.shadow_root

0 commit comments

Comments
 (0)