add 'ids' to the form_and_replace form and address other review comments

arovitn 8 years ago
parent 6fc09088ed
commit 33c1dea080

@ -163,6 +163,7 @@ define([
var allCellsButton = $('<button/>')
.append($('<i/>').addClass('fa fa-arrows-v'))
.attr('id', 'allcells_id')
.attr('type', 'button')
.addClass("btn btn-default btn-sm")
.attr('data-toggle','button')
@ -179,6 +180,7 @@ define([
var search = $("<input/>")
.addClass('form-control input-sm')
.attr('id', 'input_id')
.attr('placeholder',i18n.msg._('Find'));
var findFormGroup = $('<div/>').addClass('form-group');
@ -194,6 +196,7 @@ define([
)
var replace = $("<input/>")
.attr('id', 'replace_id')
.addClass('form-control input-sm')
.attr('placeholder',i18n.msg._('Replace'));
var replaceFormGroup = $('<div/>').addClass('form-group');
@ -354,7 +357,8 @@ define([
keyboard_manager: env.notebook.keyboard_manager,
buttons:{
'Replace All':{ class: "btn-primary",
click: function(event){onsubmit(event); return true;}
click: function(event){onsubmit(event); return true;},
id: "replaceall_id",
}
},
open: function(){

@ -102,17 +102,13 @@ class Notebook:
def find_and_replace(self, index=0, find_txt='', replace_txt='', replace_all=False):
self.focus_cell(index)
esc(self.browser, 'F')
time.sleep(1) # TODO: find better way to fill the find and replace form
self.browser.find_elements_by_css_selector("button.btn.btn-default.btn-sm")[2].click()
JS = "document.getElementsByClassName('form-control input-sm')[0].setAttribute('value', '%s')"%find_txt
self.browser.execute_script(JS)
JS = "document.getElementsByClassName('form-control input-sm')[1].setAttribute('value', '%s')"%replace_txt
self.browser.execute_script(JS)
self.body.send_keys(Keys.TAB)
self.body.send_keys(Keys.TAB)
self.body.send_keys(Keys.ENTER)
time.sleep(1)
self.to_command_mode()
self.body.send_keys('f')
wait_for_selector(self.browser, "#find-and-replace", single=True)
self.browser.find_element_by_id("allcells_id").click()
self.browser.find_element_by_id("input_id").send_keys(find_txt)
self.browser.find_element_by_id("replace_id").send_keys(replace_txt)
self.browser.find_element_by_id("replaceall_id").click()
def convert_cell_type(self, index=0, cell_type="code"):
# TODO add check to see if it is already present
@ -273,8 +269,3 @@ def ctrl(browser, k):
ActionChains(browser)\
.key_down(Keys.CONTROL).send_keys(k).key_up(Keys.CONTROL).perform()
def esc(browser, k):
"""Send key combination esc+(k)"""
ActionChains(browser)\
.key_down(Keys.ESCAPE).send_keys(k).key_up(Keys.ESCAPE).perform()

Loading…
Cancel
Save