Skip to content

Commit b22994e

Browse files
author
arovitn
committed
renamed the ids, removed the replace_all parameter and changed the name of the testcase as mentioned in the comments
1 parent 33c1dea commit b22994e

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

notebook/static/notebook/js/searchandreplace.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ define([
163163

164164
var allCellsButton = $('<button/>')
165165
.append($('<i/>').addClass('fa fa-arrows-v'))
166-
.attr('id', 'allcells_id')
166+
.attr('id', 'findreplace_allcells_btn')
167167
.attr('type', 'button')
168168
.addClass("btn btn-default btn-sm")
169169
.attr('data-toggle','button')
@@ -180,7 +180,7 @@ define([
180180

181181
var search = $("<input/>")
182182
.addClass('form-control input-sm')
183-
.attr('id', 'input_id')
183+
.attr('id', 'findreplace_find_inp')
184184
.attr('placeholder',i18n.msg._('Find'));
185185

186186
var findFormGroup = $('<div/>').addClass('form-group');
@@ -196,7 +196,7 @@ define([
196196
)
197197

198198
var replace = $("<input/>")
199-
.attr('id', 'replace_id')
199+
.attr('id', 'findreplace_replace_inp')
200200
.addClass('form-control input-sm')
201201
.attr('placeholder',i18n.msg._('Replace'));
202202
var replaceFormGroup = $('<div/>').addClass('form-group');
@@ -358,7 +358,7 @@ define([
358358
buttons:{
359359
'Replace All':{ class: "btn-primary",
360360
click: function(event){onsubmit(event); return true;},
361-
id: "replaceall_id",
361+
id: "findreplace_replaceall_btn",
362362
}
363363
},
364364
open: function(){

notebook/tests/selenium/test_find_and_replace_apply_all.py renamed to notebook/tests/selenium/test_find_and_replace.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import os
21
import pytest
32

43

5-
def test_find_and_replace_apply_all(notebook):
4+
def test_find_and_replace(notebook):
65
""" test find and replace on all the cells """
76
cell_0, cell_1, cell_2, cell_3 = "hello", "hellohello", "abc", "ello"
87

@@ -16,7 +15,7 @@ def test_find_and_replace_apply_all(notebook):
1615
notebook.add_cell(index=3, content=cell_3);
1716

1817
# replace the strings
19-
notebook.find_and_replace(index=0, find_txt=find_str, replace_txt=replace_str, replace_all=True)
18+
notebook.find_and_replace(index=0, find_txt=find_str, replace_txt=replace_str)
2019

2120
# check content of the cells
2221
assert notebook.get_cell_contents(0) == cell_0.replace(find_str, replace_str)

notebook/tests/selenium/utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@ def focus_cell(self, index=0):
100100
self.to_command_mode()
101101
self.current_cell = cell
102102

103-
def find_and_replace(self, index=0, find_txt='', replace_txt='', replace_all=False):
103+
def find_and_replace(self, index=0, find_txt='', replace_txt=''):
104104
self.focus_cell(index)
105105
self.to_command_mode()
106106
self.body.send_keys('f')
107107
wait_for_selector(self.browser, "#find-and-replace", single=True)
108-
self.browser.find_element_by_id("allcells_id").click()
109-
self.browser.find_element_by_id("input_id").send_keys(find_txt)
110-
self.browser.find_element_by_id("replace_id").send_keys(replace_txt)
111-
self.browser.find_element_by_id("replaceall_id").click()
108+
self.browser.find_element_by_id("findreplace_allcells_btn").click()
109+
self.browser.find_element_by_id("findreplace_find_inp").send_keys(find_txt)
110+
self.browser.find_element_by_id("findreplace_replace_inp").send_keys(replace_txt)
111+
self.browser.find_element_by_id("findreplace_replaceall_btn").click()
112112

113113
def convert_cell_type(self, index=0, cell_type="code"):
114114
# TODO add check to see if it is already present

0 commit comments

Comments
 (0)