Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneswilm committed Feb 9, 2025
1 parent c9ffe80 commit 067b2ec
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
12 changes: 6 additions & 6 deletions fiduswriter/book/static/js/modules/books/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ export class BookActions {
return escapeText(longFilePath(book.title, book.path))
})
const buttons = [
{
type: "close"
},
{
text: gettext("Delete"),
classes: "fw-dark",
Expand All @@ -137,9 +140,6 @@ export class BookActions {
this.bookOverview.initTable()
})
}
},
{
type: "close"
}
]

Expand Down Expand Up @@ -175,6 +175,9 @@ export class BookActions {
}

const buttons = [
{
type: "cancel"
},
{
text: gettext("Submit"),
classes: "fw-dark",
Expand All @@ -188,9 +191,6 @@ export class BookActions {
})
dialog.close()
}
},
{
type: "cancel"
}
]

Expand Down
4 changes: 4 additions & 0 deletions fiduswriter/book/static/js/modules/books/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ export class BookOverview {
data: fileList
},
columns: [
{
select: 0,
type: "number"
},
{
select: hiddenCols,
hidden: true
Expand Down
4 changes: 2 additions & 2 deletions fiduswriter/book/static/js/modules/books/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const menuModel = () => ({
{
type: "text",
title: gettext("Create new book"),
keys: "n",
keys: "Alt-n",
action: overview => {
overview.getImageDB().then(() => {
overview.mod.actions.createBookDialog(0, overview.imageDB)
Expand All @@ -26,7 +26,7 @@ export const menuModel = () => ({
{
type: "text",
title: gettext("Create new folder"),
keys: "o",
keys: "Alt-f",
action: overview => {
const dialog = new NewFolderDialog(folderName => {
overview.path = overview.path + folderName + "/"
Expand Down
14 changes: 9 additions & 5 deletions fiduswriter/book/tests/test_book.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def test_books(self):
).click()
# Create a new book
self.driver.find_element(
By.CSS_SELECTOR, 'button[title="Create new book"]'
By.CSS_SELECTOR, 'button[title="Create new book (Alt-n)"]'
).click()
self.driver.find_element(By.ID, "book-title").send_keys("My book")
self.driver.find_element(By.ID, "book-metadata-author").send_keys(
Expand Down Expand Up @@ -366,7 +366,11 @@ def test_books(self):
),
0,
)

# Edit title
self.driver.find_element(By.CSS_SELECTOR, ".book-title").click()
# Move focus
self.driver.find_element(By.CSS_SELECTOR, ".fw-tablerow-title").click()
self.driver.find_element(By.ID, "book-title").send_keys(" EXTRA")
self.driver.find_element(
By.CSS_SELECTOR, 'a[href="#optionTab1"]'
Expand Down Expand Up @@ -603,7 +607,7 @@ def test_path(self):
# Create a new book
WebDriverWait(self.driver, self.wait_time).until(
EC.element_to_be_clickable(
(By.CSS_SELECTOR, 'button[title="Create new book"]')
(By.CSS_SELECTOR, 'button[title="Create new book (Alt-n)"]')
)
).click()
self.driver.find_element(By.CSS_SELECTOR, "#book-title").click()
Expand All @@ -626,7 +630,7 @@ def test_path(self):
)
# Create new folder 'Releases' and enter
self.driver.find_element(
By.CSS_SELECTOR, 'button[title="Create new folder"]'
By.CSS_SELECTOR, 'button[title="Create new folder (Alt-f)"]'
).click()
self.driver.find_element(By.CSS_SELECTOR, "#new-folder-name").click()
self.driver.find_element(
Expand All @@ -649,7 +653,7 @@ def test_path(self):
# Create second book inside of Releases folder
WebDriverWait(self.driver, self.wait_time).until(
EC.element_to_be_clickable(
(By.CSS_SELECTOR, 'button[title="Create new book"]')
(By.CSS_SELECTOR, 'button[title="Create new book (Alt-n)"]')
)
).click()
self.driver.find_element(By.CSS_SELECTOR, "#book-title").click()
Expand Down Expand Up @@ -949,7 +953,7 @@ def test_sanity_check(self):
).click()
# Create a new book
self.driver.find_element(
By.CSS_SELECTOR, 'button[title="Create new book"]'
By.CSS_SELECTOR, 'button[title="Create new book (Alt-n)"]'
).click()
self.driver.find_element(By.ID, "book-title").send_keys("My book")
self.driver.find_element(
Expand Down

0 comments on commit 067b2ec

Please sign in to comment.