Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

refactored CSS and applied BEM notations

Jonas Jabari3d22248b64b7
diff --git a/app/components/work_packages/activities_tab/index_component.html.erb b/app/components/work_packages/activities_tab/index_component.html.erb
index bfd5bc31fa5..0235914aa29 100644
--- a/app/components/work_packages/activities_tab/index_component.html.erb
+++ b/app/components/work_packages/activities_tab/index_component.html.erb
@@ -1,6 +1,6 @@
<%=
content_tag("turbo-frame", id: "work-package-activities-tab-content") do
- component_wrapper(data: wrapper_data_attributes) do
+ component_wrapper(data: wrapper_data_attributes, class: "work-packages-activities-tab-index-component") do
flex_layout do |activties_tab_container|
activties_tab_container.with_row(mb: 2) do
render(
@@ -12,8 +12,7 @@
end
activties_tab_container.with_row(flex_layout: true, mt: 3) do |journals_wrapper_container|
journals_wrapper_container.with_row(
- id: "journals-container",
- classes: "with-initial-input-compensation",
+ classes: "work-packages-activities-tab-index-component--journals-container work-packages-activities-tab-index-component--journals-container_with-initial-input-compensation",
data: { "work-packages--activities-tab--index-target": "journalsContainer" }
) do
render(
@@ -22,8 +21,7 @@
end
if adding_comment_allowed?
journals_wrapper_container.with_row(
- id: "input-container",
- classes: "sort-#{journal_sorting}", # css order attribute will take care of correct position
+ classes: "work-packages-activities-tab-index-component--input-container work-packages-activities-tab-index-component--input-container_sort-#{journal_sorting}",
mt: 3,
mb: [3, nil, nil, nil, 0],
pt: 2,
@@ -43,4 +41,4 @@
end
end
end
-%>
+%>
\ No newline at end of file
diff --git a/app/components/work_packages/activities_tab/index_component.sass b/app/components/work_packages/activities_tab/index_component.sass
index b7d54104b9a..febca87c159 100644
--- a/app/components/work_packages/activities_tab/index_component.sass
+++ b/app/components/work_packages/activities_tab/index_component.sass
@@ -1,27 +1,20 @@
-#work-packages-activities-tab-index-component
- #journals-container
+.work-packages-activities-tab-index-component
+ &--journals-container
z-index: 10
padding-top: 3px
overflow-y: auto
- &.with-initial-input-compensation
+
+ &_with-initial-input-compensation
margin-bottom: 65px // initial margin-bottom, will be increased by stimulus when opening ckeditor
@media screen and (max-width: $breakpoint-xl)
margin-bottom: -16px
- &.with-input-compensation
+
+ &_with-input-compensation
margin-bottom: 180px
@media screen and (max-width: $breakpoint-xl)
margin-bottom: -16px
- #stem-connection
- @media screen and (min-width: $breakpoint-xl)
- position: absolute
- z-index: 9
- border-left: var(--borderWidth-thin, 1px) solid var(--borderColor-default)
- margin-left: 19px
- margin-top: 20px
- height: 100vh
- @media screen and (max-width: $breakpoint-xl)
- display: none
- #input-container
+
+ &--input-container
z-index: 10
@media screen and (min-width: $breakpoint-xl)
position: absolute
@@ -29,6 +22,7 @@
bottom: 0
left: 0
right: 0
- @media screen and (max-width: $breakpoint-xl)
- &.sort-desc
- order: -1
\ No newline at end of file
+
+ &_sort-desc
+ @media screen and (max-width: $breakpoint-xl)
+ order: -1
diff --git a/app/components/work_packages/activities_tab/journals/index_component.html.erb b/app/components/work_packages/activities_tab/journals/index_component.html.erb
index c600de950ba..ee160af50bd 100644
--- a/app/components/work_packages/activities_tab/journals/index_component.html.erb
+++ b/app/components/work_packages/activities_tab/journals/index_component.html.erb
@@ -1,7 +1,7 @@
<%=
- component_wrapper do
+ component_wrapper(class: "work-packages-activities-tab-journals-index-component") do
flex_layout do |journals_index_wrapper_container|
- journals_index_wrapper_container.with_row(id: "wp-journals-inner-container", mb: inner_container_margin_bottom) do
+ journals_index_wrapper_container.with_row(classes: "work-packages-activities-tab-journals-index-component--journals-inner-container", mb: inner_container_margin_bottom) do
flex_layout(id: insert_target_modifier_id, data: { "test_selector": "op-wp-journals-container" }) do |journals_index_container|
if empty_state?
journals_index_container.with_row(mt: 2, mb: 3) do
@@ -19,7 +19,7 @@
end
end
end
- journals_index_wrapper_container.with_row(id: "wp-stem-connection") unless empty_state?
+ journals_index_wrapper_container.with_row(classes: "work-packages-activities-tab-journals-index-component--stem-connection") unless empty_state?
end
end
%>
diff --git a/app/components/work_packages/activities_tab/journals/index_component.sass b/app/components/work_packages/activities_tab/journals/index_component.sass
index bc33e929f1f..2087798b527 100644
--- a/app/components/work_packages/activities_tab/journals/index_component.sass
+++ b/app/components/work_packages/activities_tab/journals/index_component.sass
@@ -1,7 +1,7 @@
-#work-packages-activities-tab-journals-index-component
- #wp-journals-inner-container
+.work-packages-activities-tab-journals-index-component
+ &--journals-inner-container
z-index: 10
- #wp-stem-connection
+ &--stem-connection
@media screen and (min-width: $breakpoint-xl)
position: absolute
z-index: 9
diff --git a/app/components/work_packages/activities_tab/journals/item_component.html.erb b/app/components/work_packages/activities_tab/journals/item_component.html.erb
index 35292b2e3f0..d51e6c0fb37 100644
--- a/app/components/work_packages/activities_tab/journals/item_component.html.erb
+++ b/app/components/work_packages/activities_tab/journals/item_component.html.erb
@@ -2,12 +2,12 @@
component_wrapper(data: wrapper_data_attributes, class: "work-packages-activities-tab-journals-item-component") do
flex_layout(data: { "test_selector": "op-wp-journal-entry-#{journal.id}" }) do |journal_container|
if show_comment_container?
- journal_container.with_row(classes: "journal-notes-border-box") do
+ journal_container.with_row do
render(border_box_container(
id: "activity-#{journal.version}",
padding: :condensed
)) do |border_box_component|
- border_box_component.with_header(px: 2, py: 1, classes: "journal-notes-header") do
+ border_box_component.with_header(px: 2, py: 1, data: { test_selector: "op-journal-notes-header" }) do
flex_layout(align_items: :center, justify_content: :space_between) do |header_container|
header_container.with_column(flex_layout: true) do |header_start_container|
header_start_container.with_column(mr: 2) do
@@ -27,7 +27,7 @@
end
header_container.with_column(flex_layout: true, align_items: :center) do |header_end_container|
if has_unread_notifications?
- header_end_container.with_column(mr: 2, pt: 1, classes: "bubble-container") do
+ header_end_container.with_column(mr: 2, pt: 1, classes: "work-packages-activities-tab-journals-item-component--bubble-container") do
bubble_html
end
end
@@ -55,7 +55,7 @@
end
end
end
- border_box_component.with_body(classes: "journal-notes-body") do
+ border_box_component.with_body(classes: "work-packages-activities-tab-journals-item-component--journal-notes-body") do
content
end
end
diff --git a/app/components/work_packages/activities_tab/journals/item_component.sass b/app/components/work_packages/activities_tab/journals/item_component.sass
index d02c5bc4d0c..137934f33f5 100644
--- a/app/components/work_packages/activities_tab/journals/item_component.sass
+++ b/app/components/work_packages/activities_tab/journals/item_component.sass
@@ -1,7 +1,9 @@
.work-packages-activities-tab-journals-item-component
+ &--bubble-container
+ padding-top: 2px
action-menu
+ // TODO: primer style adjustments, needs refactoring
button
padding-top: 3px // for whatever reason, the dots in the action menu are not perfectly aligned in center vertically by default
- .bubble-container:
- padding-top: 2px
+
diff --git a/app/components/work_packages/activities_tab/journals/item_component/details.html.erb b/app/components/work_packages/activities_tab/journals/item_component/details.html.erb
index 2740ce426bc..0c496047596 100644
--- a/app/components/work_packages/activities_tab/journals/item_component/details.html.erb
+++ b/app/components/work_packages/activities_tab/journals/item_component/details.html.erb
@@ -1,18 +1,18 @@
<%= component_wrapper(class: "work-packages-activities-tab-journals-item-component-details") do
case filter
when :only_comments
- flex_layout(my: 0, border: :left, classes: "journal-details-container") do |details_container|
+ flex_layout(my: 0, border: :left, classes: "work-packages-activities-tab-journals-item-component-details--journal-details-container") do |details_container|
render_empty_line(details_container) unless journal.initial?
end
when :only_changes
if journal.details.any?
- flex_layout(my: 0, border: :left, classes: "journal-details-container") do |details_container|
+ flex_layout(my: 0, border: :left, classes: "work-packages-activities-tab-journals-item-component-details--journal-details-container") do |details_container|
render_details_header(details_container)
render_details(details_container)
end
end
else # :all or any other state
- flex_layout(my: 0, border: :left, classes: "journal-details-container") do |details_container|
+ flex_layout(my: 0, border: :left, classes: "work-packages-activities-tab-journals-item-component-details--journal-details-container") do |details_container|
if journal.details.any?
if journal.notes.present?
render_details(details_container)
diff --git a/app/components/work_packages/activities_tab/journals/item_component/details.rb b/app/components/work_packages/activities_tab/journals/item_component/details.rb
index 1a6a3e624ca..33424259864 100644
--- a/app/components/work_packages/activities_tab/journals/item_component/details.rb
+++ b/app/components/work_packages/activities_tab/journals/item_component/details.rb
@@ -54,17 +54,22 @@ module WorkPackages
end
def render_details_header(details_container)
- details_container.with_row(flex_layout: true,
- justify_content: :space_between,
- classes: "journal-details-header-container",
- id: "activity-#{journal.version}") do |header_container|
+ details_container.with_row(
+ flex_layout: true,
+ justify_content: :space_between,
+ classes: "work-packages-activities-tab-journals-item-component-details--journal-details-header-container",
+ id: "activity-#{journal.version}"
+ ) do |header_container|
render_header_start(header_container)
render_header_end(header_container)
end
end
def render_header_start(header_container)
- header_container.with_column(flex_layout: true, classes: "journal-details-header") do |header_start_container|
+ header_container.with_column(
+ flex_layout: true,
+ classes: "work-packages-activities-tab-journals-item-component-details--journal-details-header"
+ ) do |header_start_container|
render_timeline_icon(header_start_container)
render_user_avatar(header_start_container)
render_user_name_and_time(header_start_container)
@@ -74,7 +79,7 @@ module WorkPackages
end
def render_timeline_icon(container)
- container.with_column(mr: 2, classes: "timeline-icon") do
+ container.with_column(mr: 2, classes: "work-packages-activities-tab-journals-item-component-details--timeline-icon") do
icon_name = journal.initial? ? "diff-added" : "diff-modified"
render Primer::Beta::Octicon.new(icon: icon_name, size: :small, "aria-label": icon_aria_label, color: :subtle)
end
@@ -120,7 +125,8 @@ module WorkPackages
end
def render_notification_bubble(container)
- container.with_column(mr: 2, classes: "bubble-container") do
+ container.with_column(mr: 2,
+ classes: "work-packages-activities-tab-journals-item-component-details--bubble-container") do
bubble_html
end
end
@@ -173,12 +179,16 @@ module WorkPackages
end
def render_stem_line(container)
- container.with_column(classes: "journal-detail-stem-line")
+ container.with_column(classes: "work-packages-activities-tab-journals-item-component-details--journal-detail-stem-line")
end
def render_detail_description(container, detail)
container.with_column(pl: 1, font_size: :small) do
- render(Primer::Beta::Text.new(classes: "journal-detail-description")) { journal.render_detail(detail) }
+ render(Primer::Beta::Text.new(
+ classes: "work-packages-activities-tab-journals-item-component-details--journal-detail-description"
+ )) do
+ journal.render_detail(detail)
+ end
end
end
diff --git a/app/components/work_packages/activities_tab/journals/item_component/details.sass b/app/components/work_packages/activities_tab/journals/item_component/details.sass
index d9e7766d57f..96cead666a7 100644
--- a/app/components/work_packages/activities_tab/journals/item_component/details.sass
+++ b/app/components/work_packages/activities_tab/journals/item_component/details.sass
@@ -1,12 +1,12 @@
.work-packages-activities-tab-journals-item-component-details
- .journal-details-container
+ &--journal-details-container
margin-left: 19px
min-height: 20px
- .journal-details-container--empty--last--asc
+ &--journal-details-container--empty--last--asc
display: none!important
- .journal-details-header-container
+ &--journal-details-header-container
margin-left: -14px
- .timeline-icon
+ &--timeline-icon
background-color: var(--bgColor-muted)
border-radius: 50%
width: 28px
@@ -14,13 +14,13 @@
text-align: center
padding-top: 3px
margin-top: -2px
- .empty-line
+ &--empty-line
margin-top: 0px!important
margin-bottom: 0px!important
- .journal-detail-stem-line
+ &--journal-detail-stem-line
position: relative
width: 20px
- .journal-detail-stem-line::before
+ &--journal-detail-stem-line::before
content: ""
position: absolute
top: 10px
@@ -29,10 +29,10 @@
height: var(--borderWidth-thin, 1px)
background-color: var(--borderColor-default)
transform: translateY(-50%)
- .journal-detail-description
+ &--journal-detail-description
// quick hack to adapt the current detail rendering to desired primerised design
i
font-style: normal
color: var(--fgColor-muted, var(--color-fg-subtle))
- .bubble-container
+ &--bubble-container
padding-top: 2px
\ No newline at end of file
diff --git a/app/components/work_packages/activities_tab/journals/item_component/edit.html.erb b/app/components/work_packages/activities_tab/journals/item_component/edit.html.erb
index a17fb186d2f..b1144aa3913 100644
--- a/app/components/work_packages/activities_tab/journals/item_component/edit.html.erb
+++ b/app/components/work_packages/activities_tab/journals/item_component/edit.html.erb
@@ -2,14 +2,14 @@
component_wrapper(class: "work-packages-activities-tab-journals-item-component-edit") do
render(Primer::Box.new(my: 3)) do
primer_form_with(
- id: "work-package-journal-form",
+ id: "work-package-journal-form", # required for specs
model: journal,
method: :put,
data: { turbo: true, turbo_stream: true },
url: work_package_activity_path(work_package_id: work_package.id, id: journal.id, filter:),
) do |f|
flex_layout do |form_container|
- form_container.with_row do
+ form_container.with_row(id: "ck-editor-adjustment-container") do
render(WorkPackages::ActivitiesTab::Journals::NotesForm.new(f))
end
form_container.with_row(flex_layout: true, mt: 3, justify_content: :flex_end) do |submit_container|
diff --git a/app/components/work_packages/activities_tab/journals/item_component/edit.sass b/app/components/work_packages/activities_tab/journals/item_component/edit.sass
index 38adcf394e0..db9b6228a98 100644
--- a/app/components/work_packages/activities_tab/journals/item_component/edit.sass
+++ b/app/components/work_packages/activities_tab/journals/item_component/edit.sass
@@ -1,13 +1,21 @@
.work-packages-activities-tab-journals-item-component-edit
- // prototypical primer style adoptions
- .ck-toolbar
- border-radius: var(--borderRadius-medium) var(--borderRadius-medium) 0px 0px!important
- .document-editor__editable-container
- background: var(--color-scale-white)
- border-radius: 0px 0px var(--borderRadius-medium) var(--borderRadius-medium)!important
- .ck-content
- background: var(--color-scale-white)
- overflow-y: auto
- border-radius: var(--borderRadius-medium)!important
- margin: 5px
+ // prototypical primer style adoptions, using ID in order to get higher priority, needs refactoring
+ #ck-editor-adjustment-container
+ .ck-toolbar
+ border-radius: var(--borderRadius-medium) var(--borderRadius-medium) 0px 0px
+ .document-editor__editable-container
+ background: var(--bgColor-default)
+ border-radius: 0px 0px var(--borderRadius-medium) var(--borderRadius-medium)
+ .ck-content
+ background: var(--bgColor-default)
+ overflow-y: auto
+ border-radius: var(--borderRadius-medium)
+ margin: 5px
+ .CodeMirror
+ border-radius: 0px 0px var(--borderRadius-medium) var(--borderRadius-medium)
+ .ck-editor__preview
+ border-radius: 0px 0px var(--borderRadius-medium) var(--borderRadius-medium)
+ // overwrites margin bottom defined in _ckeditor.sass:13
+ opce-ckeditor-augmented-textarea .op-ckeditor--wrapper
+ margin-bottom: 0px
diff --git a/app/components/work_packages/activities_tab/journals/new_component.html.erb b/app/components/work_packages/activities_tab/journals/new_component.html.erb
index 29c6da285a9..ed205021aee 100644
--- a/app/components/work_packages/activities_tab/journals/new_component.html.erb
+++ b/app/components/work_packages/activities_tab/journals/new_component.html.erb
@@ -1,5 +1,5 @@
<%=
- component_wrapper do
+ component_wrapper(class: "work-packages-activities-tab-journals-new-component") do
flex_layout(my: 2, data: { test_selector: "op-work-package-journal-form" }) do |new_form_container|
new_form_container.with_row(
display: button_row_display_value,
@@ -7,15 +7,15 @@
"work-packages--activities-tab--index-target": "buttonRow"
}) do
flex_layout(justify_content: :space_between) do |button_row|
- button_row.with_column(id: "input-trigger-column", mr: 2) do
+ button_row.with_column(classes: "work-packages-activities-tab-journals-new-component--input-trigger-column", mr: 2) do
render(Primer::Beta::Button.new(
- id: "open-work-package-journal-form",
text_align: :left,
scheme: :default,
size: :medium,
block: true,
data: {
- "action": "click->work-packages--activities-tab--index#showForm"
+ "action": "click->work-packages--activities-tab--index#showForm",
+ "test_selector": "op-open-work-package-journal-form-trigger"
}
)) do
render(Primer::Beta::Text.new(color: :muted, font_weight: :normal)) { t("activities.work_packages.activity_tab.label_type_to_comment") }
@@ -36,14 +36,24 @@
data: { "work-packages--activities-tab--index-target": "formRow" }
) do
primer_form_with(
- id: "work-package-journal-form",
+ id: "work-package-journal-form-element", # required for specs
model: journal,
method: :post,
- data: { turbo: true, turbo_stream: true, "work-packages--activities-tab--index-target": "form", action: "submit->work-packages--activities-tab--index#onSubmit" },
+ data: {
+ turbo: true,
+ turbo_stream: true,
+ "work-packages--activities-tab--index-target": "form",
+ action: "submit->work-packages--activities-tab--index#onSubmit",
+ "test_selector": "op-work-package-journal-form-element"
+ },
url: work_package_activities_path(work_package_id: work_package.id),
) do |f|
flex_layout(justify_content: :space_between, align_items: :flex_end) do |form_container|
- form_container.with_column(id: "ck-editor-column", mr: 2) do
+ form_container.with_column(
+ id: "ck-editor-adjustment-container",
+ classes: "work-packages-activities-tab-journals-new-component--ck-editor-column",
+ mr: 2
+ ) do
render(WorkPackages::ActivitiesTab::Journals::NotesForm.new(f))
end
form_container.with_column do
diff --git a/app/components/work_packages/activities_tab/journals/new_component.sass b/app/components/work_packages/activities_tab/journals/new_component.sass
index da0585d71b1..f4e406c58a2 100644
--- a/app/components/work_packages/activities_tab/journals/new_component.sass
+++ b/app/components/work_packages/activities_tab/journals/new_component.sass
@@ -1,28 +1,36 @@
-#work-packages-activities-tab-journals-new-component
- #input-trigger-column
+.work-packages-activities-tab-journals-new-component
+ &--input-trigger-column
width: 100%
button
background: var(--bgColor-default)
cursor: text
.Button-content
display: block
- #ck-editor-column
+ &--ck-editor-column
width: 100%
@media screen and (max-width: $breakpoint-md)
width: calc(100% - 40px)
- // prototypical primer style adoptions
- .ck-toolbar
- border-radius: var(--borderRadius-medium) var(--borderRadius-medium) 0px 0px
- .document-editor__editable-container
- background: var(--bgColor-default)
- border-radius: 0px 0px var(--borderRadius-medium) var(--borderRadius-medium)
- .ck-content
- background: var(--bgColor-default)
- max-height: 30vh
- overflow-y: auto
- border-radius: var(--borderRadius-medium)
- margin: 5px
- // overwrites margin bottom defined in _ckeditor.sass:13
- opce-ckeditor-augmented-textarea .op-ckeditor--wrapper
- margin-bottom: 0px
+ // prototypical primer style adoptions, using ID in order to get higher priority, needs refactoring
+ #ck-editor-adjustment-container
+ .ck-toolbar
+ border-radius: var(--borderRadius-medium) var(--borderRadius-medium) 0px 0px
+ .document-editor__editable-container
+ background: var(--bgColor-default)
+ border-radius: 0px 0px var(--borderRadius-medium) var(--borderRadius-medium)
+ .ck-content
+ background: var(--bgColor-default)
+ max-height: 30vh
+ overflow-y: auto
+ border-radius: var(--borderRadius-medium)
+ margin: 5px
+ .ck-editor__source
+ max-height: 30vh
+ .CodeMirror
+ border-radius: 0px 0px var(--borderRadius-medium) var(--borderRadius-medium)
+ .ck-editor__preview
+ max-height: 30vh
+ border-radius: 0px 0px var(--borderRadius-medium) var(--borderRadius-medium)
+ // overwrites margin bottom defined in _ckeditor.sass:13
+ opce-ckeditor-augmented-textarea .op-ckeditor--wrapper
+ margin-bottom: 0px
diff --git a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts
index cddfd54c27c..fc41600399c 100644
--- a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts
@@ -296,7 +296,7 @@ export default class IndexController extends Controller {
this.buttonRowTarget.classList.add('d-none');
this.formRowTarget.classList.remove('d-none');
- this.journalsContainerTarget?.classList.add('with-input-compensation');
+ this.journalsContainerTarget?.classList.add('work-packages-activities-tab-index-component--journals-container_with-input-compensation');
this.addEventListenersToCkEditorInstance();
@@ -357,8 +357,8 @@ export default class IndexController extends Controller {
if (this.journalsContainerTarget) {
this.journalsContainerTarget.style.marginBottom = '';
- this.journalsContainerTarget.classList.add('with-initial-input-compensation');
- this.journalsContainerTarget.classList.remove('with-input-compensation');
+ this.journalsContainerTarget.classList.add('work-packages-activities-tab-index-component--journals-container_with-initial-input-compensation');
+ this.journalsContainerTarget.classList.remove('work-packages-activities-tab-index-component--journals-container_with-input-compensation');
}
}
}
@@ -389,7 +389,7 @@ export default class IndexController extends Controller {
}
if (this.journalsContainerTarget) {
this.journalsContainerTarget.style.marginBottom = '';
- this.journalsContainerTarget.classList.add('with-input-compensation');
+ this.journalsContainerTarget.classList.add('work-packages-activities-tab-index-component--journals-container_with-input-compensation');
}
setTimeout(() => {
this.scrollJournalContainer(
diff --git a/spec/features/activities/work_package/activities_spec.rb b/spec/features/activities/work_package/activities_spec.rb
index 3cdb2e7e20f..358f78291d7 100644
--- a/spec/features/activities/work_package/activities_spec.rb
+++ b/spec/features/activities/work_package/activities_spec.rb
@@ -761,8 +761,8 @@ RSpec.describe "Work package activity", :js, :with_cuprite, with_flag: { primeri
page.find("li[data-tab-id=\"activity\"]").click
# expect the editor content to be rescued on the client side
- within("#work-package-journal-form") do
- editor = FormFields::Primerized::EditorFormField.new("notes", selector: "#work-package-journal-form")
+ within_test_selector("op-work-package-journal-form-element") do
+ editor = FormFields::Primerized::EditorFormField.new("notes", selector: "#work-package-journal-form-element")
editor.expect_value("First comment by admin")
# save the comment, which was rescued on the client side
page.find_test_selector("op-submit-work-package-journal-form").click
@@ -790,8 +790,8 @@ RSpec.describe "Work package activity", :js, :with_cuprite, with_flag: { primeri
page.find_by_id("open-work-package-journal-form").click
# expect the editor content to be empty
- within("#work-package-journal-form") do
- editor = FormFields::Primerized::EditorFormField.new("notes", selector: "#work-package-journal-form")
+ within_test_selector("op-work-package-journal-form-element") do
+ editor = FormFields::Primerized::EditorFormField.new("notes", selector: "#work-package-journal-form-element")
editor.expect_value("")
end
end
@@ -816,8 +816,8 @@ RSpec.describe "Work package activity", :js, :with_cuprite, with_flag: { primeri
page.find_by_id("open-work-package-journal-form").click
# expect the editor content to be empty
- within("#work-package-journal-form") do
- editor = FormFields::Primerized::EditorFormField.new("notes", selector: "#work-package-journal-form")
+ within_test_selector("op-work-package-journal-form-element") do
+ editor = FormFields::Primerized::EditorFormField.new("notes", selector: "#work-package-journal-form-element")
editor.expect_value("")
end
@@ -832,8 +832,8 @@ RSpec.describe "Work package activity", :js, :with_cuprite, with_flag: { primeri
sleep 1
# expect the editor to be opened and content to be rescued for the correct user
- within("#work-package-journal-form") do
- editor = FormFields::Primerized::EditorFormField.new("notes", selector: "#work-package-journal-form")
+ within_test_selector("op-work-package-journal-form-element") do
+ editor = FormFields::Primerized::EditorFormField.new("notes", selector: "#work-package-journal-form-element")
editor.expect_value("First comment by admin")
end
end
diff --git a/spec/support/components/work_packages/activities.rb b/spec/support/components/work_packages/activities.rb
index 7200cbc7df5..e0c9f2a536f 100644
--- a/spec/support/components/work_packages/activities.rb
+++ b/spec/support/components/work_packages/activities.rb
@@ -88,11 +88,11 @@ module Components
end
def expect_journal_notes_header(text: nil)
- expect(page).to have_css(".journal-notes-header", text:)
+ expect(page).to have_test_selector("op-journal-notes-header", text:)
end
def expect_no_journal_notes_header(text: nil)
- expect(page).to have_no_css(".journal-notes-header", text:)
+ expect(page).to have_test_selector("op-journal-notes-header", text:)
end
def expect_journal_notes(text: nil)
@@ -147,13 +147,13 @@ module Components
# TODO: get rid of static sleep
sleep 1 # otherwise the stimulus component is not mounted yet and the click does not work
- if page.has_css?("#open-work-package-journal-form")
- page.find_by_id("open-work-package-journal-form").click
+ if page.find_test_selector("op-open-work-package-journal-form-trigger")
+ page.find_test_selector("op-open-work-package-journal-form-trigger").click
else
- expect(page).to have_css("#work-package-journal-form")
+ expect(page).to have_test_selector("op-work-package-journal-form-element")
end
- within("#work-package-journal-form") do
+ within_test_selector("op-work-package-journal-form-element") do
FormFields::Primerized::EditorFormField.new("notes", selector: "#work-package-journal-form").set_value(text)
page.find_test_selector("op-submit-work-package-journal-form").click if save
end
@@ -170,7 +170,7 @@ module Components
page.find_test_selector("op-wp-journal-#{journal.id}-action-menu").click
page.find_test_selector("op-wp-journal-#{journal.id}-edit").click
- within("#work-package-journal-form") do
+ within_test_selector("op-work-package-journal-form-element") do
FormFields::Primerized::EditorFormField.new("notes", selector: "#work-package-journal-form").set_value(text)
page.find_test_selector("op-submit-work-package-journal-form").click
end
@@ -188,15 +188,15 @@ module Components
page.find_test_selector("op-wp-journal-#{journal.id}-quote").click
end
- expect(page).to have_css("#work-package-journal-form")
+ expect(page).to have_test_selector("op-work-package-journal-form-element")
- within("#work-package-journal-form") do
+ within_test_selector("op-work-package-journal-form-element") do
page.find_test_selector("op-submit-work-package-journal-form").click
end
end
def get_all_comments_as_arrary
- page.all(".journal-notes-body").map(&:text)
+ page.all(".work-packages-activities-tab-journals-item-component--journal-notes-body").map(&:text)
end
def filter_journals(filter)