Skip to content

Commit

Permalink
fix: Lint issues with data-testid changes [PT-188545797]
Browse files Browse the repository at this point in the history
The linter didn't like unquoted object keys after the quoted "data-testid" key was added.

Also adds the updated built lara-typescript.js
  • Loading branch information
dougmartin committed Jan 21, 2025
1 parent 73ffcd9 commit cbc065f
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 38 deletions.
75 changes: 51 additions & 24 deletions app/assets/javascripts/lara-typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -136542,23 +136542,25 @@ var PageSettingsDialog = function (_a) {
};

var modalButtons = [{
classes: "cancel",
clickHandler: handleCloseDialog,
disabled: false,
svg: React.createElement(close_icon_1.Close, {
"classes": "cancel",
"clickHandler": handleCloseDialog,
"disabled": false,
"svg": React.createElement(close_icon_1.Close, {
height: "12",
width: "12"
}),
text: "Cancel"
"text": "Cancel",
"data-testid": "cancel-button-page-settings"
}, {
classes: "copy",
clickHandler: handleUpdateSettings,
disabled: false,
svg: React.createElement(save_icon_1.Save, {
"classes": "copy",
"clickHandler": handleUpdateSettings,
"disabled": false,
"svg": React.createElement(save_icon_1.Save, {
height: "16",
width: "16"
}),
text: "Save & Close"
"text": "Save & Close",
"data-testid": "save-and-close-button-page-settings"
}];
return React.createElement(modal_1.Modal, {
closeFunction: handleCloseDialog,
Expand All @@ -136578,7 +136580,8 @@ var PageSettingsDialog = function (_a) {
name: "pageTitle",
value: currentName,
onChange: handleNameChange,
placeholder: "Enter a title"
placeholder: "Enter a title",
"data-testid": "page-title-input"
})), React.createElement("dt", {
className: "input2 " + (isHiddenDisabled && "disabled")
}, React.createElement("label", {
Expand Down Expand Up @@ -142662,7 +142665,10 @@ var AuthoringPage = function (_a) {
(0, use_title_1.useTitle)("Edit " + pageName);
return React.createElement(React.Fragment, null, React.createElement(page_nav_container_1.PageNavContainer, null), React.createElement("header", {
className: "editPageHeader"
}, React.createElement("h2", null, "Page: ", displayTitle), React.createElement("button", {
}, React.createElement("h2", {
"data-testid": "page-title"
}, "Page: ", displayTitle), React.createElement("button", {
"data-testid": "page-settings-button",
onClick: pageSettingsClickHandler
}, React.createElement(cog_icon_1.Cog, {
height: "16",
Expand Down Expand Up @@ -142697,6 +142703,7 @@ var AuthoringPage = function (_a) {
});
}), droppableProvided.placeholder, React.createElement("button", {
className: "bigButton",
"data-testid": "add-section-button",
onClick: addSection
}, React.createElement(add_icon_1.Add, {
height: "16",
Expand Down Expand Up @@ -143148,6 +143155,8 @@ var AuthoringSection = function (_a) {
className: toggleSecondaryColumnOptionClass,
htmlFor: "toggle-secondary-column"
}, React.createElement("input", {
"data-testid": "toggle-secondary-column-checkbox" // Added data-testid
,
defaultChecked: can_collapse_small,
disabled: toggleSecondaryColumnDisabled,
id: "toggle-secondary-column",
Expand All @@ -143157,16 +143166,22 @@ var AuthoringSection = function (_a) {
}), "Allow student to hide secondary column")), React.createElement("div", {
className: "menuEnd"
}, React.createElement("ul", null, React.createElement("li", null, React.createElement("button", {
"data-testid": "collapse-button",
onClick: toggleCollapse
}, "Collapse")), React.createElement("li", null, React.createElement("button", {
"data-testid": "move-section-button",
onClick: handleMoveSection
}, "Move")), React.createElement("li", null, React.createElement("button", {
"data-testid": "copy-button",
onClick: handleCopy
}, "Copy")), React.createElement("li", null, React.createElement("button", {
"data-testid": "toggle-show-button",
onClick: toggleShow
}, show ? "Hide" : "Show")), React.createElement("li", null, React.createElement("button", {
"data-testid": "delete-button",
onClick: handleDelete
}, "Delete"))))), React.createElement(section_column_1.SectionColumn, {
"data-testid": "section-column-" + layout + "-1",
addItem: addItem,
addPageItem: addPageItem,
className: classNameForItem(layout, 0),
Expand All @@ -143175,6 +143190,7 @@ var AuthoringSection = function (_a) {
items: getColumnItems(columnValueForIndex(0)),
sectionId: id
}), layout !== "full-width" && layout !== "responsive-full-width" && React.createElement(section_column_1.SectionColumn, {
"data-testid": "section-column-" + layout + "-2",
addItem: addItem,
addPageItem: addPageItem,
className: classNameForItem(layout, 1),
Expand Down Expand Up @@ -143638,23 +143654,25 @@ var ItemEditDialog = function (_a) {
};

var standardModalButtons = [{
classes: "cancel",
clickHandler: handleCancelUpdateItem,
disabled: false,
svg: React.createElement(close_icon_1.Close, {
"classes": "cancel",
"clickHandler": handleCancelUpdateItem,
"disabled": false,
"svg": React.createElement(close_icon_1.Close, {
height: "12",
width: "12"
}),
text: "Cancel"
"text": "Cancel",
"data-testid": "cancel-item-button"
}, {
classes: "save",
clickHandler: handleSave,
disabled: false,
svg: React.createElement(save_icon_1.Save, {
"classes": "save",
"clickHandler": handleSave,
"disabled": false,
"svg": React.createElement(save_icon_1.Save, {
height: "16",
width: "16"
}),
text: "Save"
"text": "Save",
"data-testid": "save-item-button"
}];
var modalButtons = standardModalButtons;

Expand Down Expand Up @@ -144365,7 +144383,8 @@ var PageHeader = function (_a) {
className: "title-container",
onClick: handleTitleClick
}, React.createElement("div", {
className: "activity-title"
className: "activity-title",
"data-testid": "activity-title"
}, (0, render_html_1.renderHTML)(resourceName)))), React.createElement("div", {
className: "header-right"
}, React.createElement(account_owner_1.AccountOwner, {
Expand Down Expand Up @@ -145829,6 +145848,7 @@ var SectionColumn = function (_a) {
className: "addItem"
}, React.createElement("button", {
className: "smallButton",
"data-testid": "add-item-button",
onClick: showItemPicker
}, React.createElement(add_icon_1.Add, {
height: "16",
Expand Down Expand Up @@ -146792,17 +146812,24 @@ var SectionItem = function (_a) {
className: "sectionItemMenu"
}, React.createElement("div", {
className: "menuStart"
}, React.createElement(grip_lines_1.GripLines, null), React.createElement("h4", null, id, " - ", renderTitle())), React.createElement("div", {
}, React.createElement(grip_lines_1.GripLines, null), React.createElement("h4", {
"data-testid": "section-title-" + id
}, id, " - ", renderTitle())), React.createElement("div", {
className: "menuEnd"
}, React.createElement("ul", null, React.createElement("li", null, React.createElement("button", {
"data-testid": "section-collapse-button-" + id,
onClick: toggleCollapse
}, "Collapse")), React.createElement("li", null, React.createElement("button", {
"data-testid": "section-edit-button-" + id,
onClick: handleEdit
}, "Edit")), React.createElement("li", null, React.createElement("button", {
"data-testid": "section-move-button-" + id,
onClick: handleMove
}, "Move")), copyFunction && React.createElement("li", null, React.createElement("button", {
"data-testid": "section-copy-button-" + id,
onClick: handleCopy
}, "Copy")), React.createElement("li", null, React.createElement("button", {
"data-testid": "section-delete-button-" + id,
onClick: handleDelete
}, "Delete"))))), React.createElement("section", null, pageItem && getContent(), supportsPlugins && React.createElement(section_item_plugin_list_1.SectionItemPluginList, {
sectionColumn: sectionColumn,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ export const PageSettingsDialog: React.FC<IPageSettingsDialogProps> = ({
};

const modalButtons = [
{classes: "cancel", clickHandler: handleCloseDialog, disabled: false, svg: <Close height="12" width="12"/>, text: "Cancel", "data-testid": "cancel-button-page-settings"},
{classes: "copy", clickHandler: handleUpdateSettings, disabled: false, svg: <Save height="16" width="16"/>, text: "Save & Close", "data-testid": "save-and-close-button-page-settings"}
{"classes": "cancel", "clickHandler": handleCloseDialog, "disabled": false, "svg": <Close height="12" width="12"/>, "text": "Cancel", "data-testid": "cancel-button-page-settings"},
{"classes": "copy", "clickHandler": handleUpdateSettings, "disabled": false, "svg": <Save height="16" width="16"/>, "text": "Save & Close", "data-testid": "save-and-close-button-page-settings"}
];

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ export const AuthoringPage: React.FC<IPageProps> = ({
<PageNavContainer />
<header className="editPageHeader">
<h2 data-testid="page-title">Page: {displayTitle}</h2>
<button
data-testid="page-settings-button"
<button
data-testid="page-settings-button"
onClick={pageSettingsClickHandler}
>
<Cog height="16" width="16" /> Page Settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,19 @@ export const ItemEditDialog: React.FC<IItemEditDialogProps> = ({

const standardModalButtons = [
{
classes: "cancel",
clickHandler: handleCancelUpdateItem,
disabled: false,
svg: <Close height="12" width="12"/>,
text: "Cancel",
"classes": "cancel",
"clickHandler": handleCancelUpdateItem,
"disabled": false,
"svg": <Close height="12" width="12"/>,
"text": "Cancel",
"data-testid": "cancel-item-button"
},
{
classes: "save",
clickHandler: handleSave,
disabled: false,
svg: <Save height="16" width="16"/>,
text: "Save",
"classes": "save",
"clickHandler": handleSave,
"disabled": false,
"svg": <Save height="16" width="16"/>,
"text": "Save",
"data-testid": "save-item-button"
}
];
Expand Down

0 comments on commit cbc065f

Please sign in to comment.