From 3281e6db23d8f1ea6757af6eb71e87ed7a93c130 Mon Sep 17 00:00:00 2001 From: ddavison Date: Wed, 10 Jul 2019 16:20:31 -0700 Subject: [PATCH] Treat element#selector_css string appropriately Proper escaping should be used for page/base.rb#scroll_to as it is a single quoted JS string --- qa/qa/page/element.rb | 2 +- qa/spec/page/element_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qa/qa/page/element.rb b/qa/qa/page/element.rb index f9aa9cc6377..9e6fd2fdd4f 100644 --- a/qa/qa/page/element.rb +++ b/qa/qa/page/element.rb @@ -28,7 +28,7 @@ module QA end def selector_css - "[data-qa-selector='#{@name}'],.#{selector}" + %Q([data-qa-selector="#{@name}"],.#{selector}) end def expression diff --git a/qa/spec/page/element_spec.rb b/qa/spec/page/element_spec.rb index 87c9fbf74a3..20d4a00c020 100644 --- a/qa/spec/page/element_spec.rb +++ b/qa/spec/page/element_spec.rb @@ -114,7 +114,7 @@ describe QA::Page::Element do describe 'data-qa selectors' do subject { described_class.new(:my_element) } it 'properly translates to a data-qa-selector' do - expect(subject.selector_css).to include("[data-qa-selector='my_element']") + expect(subject.selector_css).to include(%q([data-qa-selector="my_element"])) end end end