Revert "WIP: Experiemental Bulk Topic Actions Dropdown (#25245)"
This reverts commit 89883b2f51
.
This commit is contained in:
parent
d34a7916c0
commit
0dcdc66f58
|
@ -1,160 +0,0 @@
|
|||
import Component from "@glimmer/component";
|
||||
import { action } from "@ember/object";
|
||||
import { inject as service } from "@ember/service";
|
||||
import { Promise } from "rsvp";
|
||||
import DButton from "discourse/components/d-button";
|
||||
import DModal from "discourse/components/d-modal";
|
||||
import Topic from "discourse/models/topic";
|
||||
import htmlSafe from "discourse-common/helpers/html-safe";
|
||||
import i18n from "discourse-common/helpers/i18n";
|
||||
//import AppendTags from "../bulk-actions/append-tags";
|
||||
//import ChangeCategory from "../bulk-actions/change-category";
|
||||
//import ChangeTags from "../bulk-actions/change-tags";
|
||||
//import NotificationLevel from "../bulk-actions/notification-level";
|
||||
|
||||
export default class BulkTopicActions extends Component {
|
||||
@service router;
|
||||
|
||||
async perform(operation) {
|
||||
this.loading = true;
|
||||
|
||||
if (this.args.model.bulkSelectHelper.selected.length > 20) {
|
||||
this.showProgress = true;
|
||||
}
|
||||
|
||||
try {
|
||||
return this._processChunks(operation);
|
||||
} catch {
|
||||
this.dialog.alert(i18n.t("generic_error"));
|
||||
} finally {
|
||||
this.loading = false;
|
||||
this.processedTopicCount = 0;
|
||||
this.showProgress = false;
|
||||
}
|
||||
}
|
||||
|
||||
_generateTopicChunks(allTopics) {
|
||||
let startIndex = 0;
|
||||
const chunkSize = 30;
|
||||
const chunks = [];
|
||||
|
||||
while (startIndex < allTopics.length) {
|
||||
chunks.push(allTopics.slice(startIndex, startIndex + chunkSize));
|
||||
startIndex += chunkSize;
|
||||
}
|
||||
|
||||
return chunks;
|
||||
}
|
||||
|
||||
_processChunks(operation) {
|
||||
const allTopics = this.args.model.bulkSelectHelper.selected;
|
||||
const topicChunks = this._generateTopicChunks(allTopics);
|
||||
const topicIds = [];
|
||||
const options = {};
|
||||
|
||||
if (this.args.model.allowSilent === true) {
|
||||
options.silent = true;
|
||||
}
|
||||
|
||||
const tasks = topicChunks.map((topics) => async () => {
|
||||
const result = await Topic.bulkOperation(topics, operation, options);
|
||||
this.processedTopicCount += topics.length;
|
||||
return result;
|
||||
});
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const resolveNextTask = async () => {
|
||||
if (tasks.length === 0) {
|
||||
const topics = topicIds.map((id) => allTopics.findBy("id", id));
|
||||
return resolve(topics);
|
||||
}
|
||||
|
||||
const task = tasks.shift();
|
||||
|
||||
try {
|
||||
const result = await task();
|
||||
if (result?.topic_ids) {
|
||||
topicIds.push(...result.topic_ids);
|
||||
}
|
||||
resolveNextTask();
|
||||
} catch {
|
||||
reject();
|
||||
}
|
||||
};
|
||||
|
||||
resolveNextTask();
|
||||
});
|
||||
}
|
||||
|
||||
@action
|
||||
setComponent(component) {
|
||||
this.activeComponent = component;
|
||||
}
|
||||
|
||||
@action
|
||||
performAction() {
|
||||
switch (this.args.model.action) {
|
||||
case "close":
|
||||
this.forEachPerformed({ type: "close" }, (t) => t.set("closed", true));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
async forEachPerformed(operation, cb) {
|
||||
const topics = await this.perform(operation);
|
||||
|
||||
if (topics) {
|
||||
topics.forEach(cb);
|
||||
this.args.model.refreshClosure?.();
|
||||
this.args.closeModal();
|
||||
this.args.model.bulkSelectHelper.toggleBulkSelect();
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
async performAndRefresh(operation) {
|
||||
await this.perform(operation);
|
||||
|
||||
this.args.model.refreshClosure?.();
|
||||
this.args.closeModal();
|
||||
}
|
||||
|
||||
<template>
|
||||
<DModal
|
||||
@title={{@model.title}}
|
||||
@closeModal={{@closeModal}}
|
||||
class="topic-bulk-actions-modal -large"
|
||||
>
|
||||
<:body>
|
||||
<div>
|
||||
{{htmlSafe (i18n "topics.bulk.selected" count=@model.topics.length)}}
|
||||
</div>
|
||||
</:body>
|
||||
|
||||
<:footer>
|
||||
{{#if @model.allowSilent}}
|
||||
<div class="topic-bulk-actions-options">
|
||||
<label
|
||||
for="topic-bulk-action-options__silent"
|
||||
class="checkbox-label"
|
||||
>
|
||||
<input
|
||||
class=""
|
||||
id="topic-bulk-action-options__silent"
|
||||
type="checkbox"
|
||||
/>{{i18n "topics.bulk.silent"}}</label>
|
||||
</div>
|
||||
{{/if}}
|
||||
<DButton
|
||||
@action={{this.performAction}}
|
||||
@icon="check"
|
||||
@label="topics.bulk.confirm"
|
||||
id="bulk-topics-confirm"
|
||||
class="btn-primary"
|
||||
/>
|
||||
</:footer>
|
||||
|
||||
</DModal>
|
||||
</template>
|
||||
}
|
|
@ -196,14 +196,6 @@ export default class TopicBulkActions extends Component {
|
|||
},
|
||||
];
|
||||
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
|
||||
if (this.args.model.initialAction === "set-component") {
|
||||
this.setComponent(this.args.model.initialComponent);
|
||||
}
|
||||
}
|
||||
|
||||
get buttons() {
|
||||
return [...this.defaultButtons, ..._customButtons].filter(({ visible }) => {
|
||||
if (visible) {
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
sortable=this.sortable
|
||||
listTitle=this.listTitle
|
||||
bulkSelectEnabled=this.bulkSelectEnabled
|
||||
bulkSelectHelper=this.bulkSelectHelper
|
||||
experimentalTopicBulkActionsEnabled=this.experimentalTopicBulkActionsEnabled
|
||||
canDoBulkActions=this.canDoBulkActions
|
||||
showTopicsAndRepliesToggle=this.showTopicsAndRepliesToggle
|
||||
newListSubset=this.newListSubset
|
||||
|
|
|
@ -48,11 +48,6 @@ export default Component.extend(LoadMore, {
|
|||
);
|
||||
},
|
||||
|
||||
@discourseComputed
|
||||
experimentalTopicBulkActionsEnabled() {
|
||||
return this.currentUser?.use_experimental_topic_bulk_actions;
|
||||
},
|
||||
|
||||
@discourseComputed
|
||||
sortable() {
|
||||
return !!this.changeSort;
|
||||
|
|
|
@ -49,7 +49,7 @@ export default class BulkSelectHelper {
|
|||
this.router.currentRoute.queryParams["filter"]) === "tracked";
|
||||
|
||||
const promise = this.selected.length
|
||||
? Topic.bulkOperation(this.selected, operation, {}, isTracked)
|
||||
? Topic.bulkOperation(this.selected, operation, isTracked)
|
||||
: Topic.bulkOperationByFilter("unread", operation, options, isTracked);
|
||||
|
||||
promise.then((result) => {
|
||||
|
|
|
@ -806,19 +806,13 @@ Topic.reopenClass({
|
|||
return promise;
|
||||
},
|
||||
|
||||
bulkOperation(topics, operation, options, tracked) {
|
||||
bulkOperation(topics, operation, tracked) {
|
||||
const data = {
|
||||
topic_ids: topics.mapBy("id"),
|
||||
operation,
|
||||
tracked,
|
||||
};
|
||||
|
||||
if (options) {
|
||||
if (options.select) {
|
||||
data.silent = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ajax("/topics/bulk", {
|
||||
type: "PUT",
|
||||
data,
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
{{{view.html}}}
|
|
@ -1,22 +1,12 @@
|
|||
<th data-sort-order='{{order}}' class='{{view.className}} topic-list-data' scope="col" {{#if ariaLabel}}aria-label='{{ariaLabel}}'{{/if}} {{#if sortable}}tabindex="0" role="button" aria-pressed='{{view.ariaPressed}}' {{#if view.ariaSort}}aria-sort='{{view.ariaSort}}'{{/if}} {{/if}}>
|
||||
{{~#if canBulkSelect}}
|
||||
{{~#if showBulkToggle}}
|
||||
{{~#if experimentalTopicBulkActionsEnabled }}
|
||||
{{raw "flat-button" class="bulk-select" icon="tasks" title="topics.bulk.toggle"}}
|
||||
{{else}}
|
||||
{{raw "flat-button" class="bulk-select" icon="list" title="topics.bulk.toggle"}}
|
||||
{{/if ~}}
|
||||
{{raw "flat-button" class="bulk-select" icon="list" title="topics.bulk.toggle"}}
|
||||
{{/if ~}}
|
||||
{{~#if bulkSelectEnabled}}
|
||||
<span class='bulk-select-topics'>
|
||||
{{~#if canDoBulkActions}}
|
||||
{{~#if experimentalTopicBulkActionsEnabled }}
|
||||
{{raw "topic-bulk-select-dropdown" bulkSelectHelper=bulkSelectHelper}}
|
||||
{{! Just showing both buttons for now for development}}
|
||||
<button class='btn btn-icon no-text bulk-select-actions'>{{d-icon "cog"}}​</button>
|
||||
{{else}}
|
||||
<button class='btn btn-icon no-text bulk-select-actions'>{{d-icon "cog"}}​</button>
|
||||
{{/if ~}}
|
||||
<button class='btn btn-default btn-icon no-text bulk-select-actions'>{{d-icon "cog"}}​</button>
|
||||
{{/if ~}}
|
||||
<button class='btn btn-default bulk-select-all'>{{i18n "topics.bulk.select_all"}}</button>
|
||||
<button class='btn btn-default bulk-clear-all'>{{i18n "topics.bulk.clear_all"}}</button>
|
||||
|
|
|
@ -2,15 +2,11 @@
|
|||
{{#if bulkSelectEnabled}}
|
||||
<th class="bulk-select topic-list-data">
|
||||
{{#if canBulkSelect}}
|
||||
{{#if experimentalTopicBulkActionsEnabled }}
|
||||
{{raw "flat-button" class="bulk-select" icon="tasks" title="topics.bulk.toggle"}}
|
||||
{{else}}
|
||||
{{raw "flat-button" class="bulk-select" icon="list" title="topics.bulk.toggle"}}
|
||||
{{/if}}
|
||||
{{raw "flat-button" class="bulk-select" icon="list" title="topics.bulk.toggle"}}
|
||||
{{/if}}
|
||||
</th>
|
||||
{{/if}}
|
||||
{{raw "topic-list-header-column" order='default' name=listTitle bulkSelectEnabled=bulkSelectEnabled showBulkToggle=toggleInTitle canBulkSelect=canBulkSelect canDoBulkActions=canDoBulkActions showTopicsAndRepliesToggle=showTopicsAndRepliesToggle newListSubset=newListSubset newRepliesCount=newRepliesCount newTopicsCount=newTopicsCount experimentalTopicBulkActionsEnabled=experimentalTopicBulkActionsEnabled bulkSelectHelper=bulkSelectHelper }}
|
||||
{{raw "topic-list-header-column" order='default' name=listTitle bulkSelectEnabled=bulkSelectEnabled showBulkToggle=toggleInTitle canBulkSelect=canBulkSelect canDoBulkActions=canDoBulkActions showTopicsAndRepliesToggle=showTopicsAndRepliesToggle newListSubset=newListSubset newRepliesCount=newRepliesCount newTopicsCount=newTopicsCount}}
|
||||
{{raw-plugin-outlet name="topic-list-header-after-main-link"}}
|
||||
{{#if showPosters}}
|
||||
{{raw "topic-list-header-column" order='posters' ariaLabel=(i18n "category.sort_options.posters")}}
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import rawRenderGlimmer from "discourse/lib/raw-render-glimmer";
|
||||
import BulkSelectTopicsDropdown from "select-kit/components/bulk-select-topics-dropdown";
|
||||
|
||||
export default class extends EmberObject {
|
||||
get selectedCount() {
|
||||
return this.bulkSelectHelper.selected.length;
|
||||
}
|
||||
|
||||
get html() {
|
||||
return rawRenderGlimmer(
|
||||
this,
|
||||
"div.bulk-select-topics-dropdown",
|
||||
<template>
|
||||
<span>{{@data.selectedCount}} selected</span>
|
||||
<BulkSelectTopicsDropdown
|
||||
@bulkSelectHelper={{@data.bulkSelectHelper}}
|
||||
/>
|
||||
</template>,
|
||||
{
|
||||
bulkSelectHelper: this.bulkSelectHelper,
|
||||
selectedCount: this.selectedCount,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
import { action } from "@ember/object";
|
||||
import { inject as service } from "@ember/service";
|
||||
import ChangeCategory from "discourse/components/bulk-actions/change-category";
|
||||
import BulkTopicActions from "discourse/components/modal/bulk-topic-actions";
|
||||
import TopicBulkActions from "discourse/components/modal/topic-bulk-actions";
|
||||
import i18n from "discourse-common/helpers/i18n";
|
||||
import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";
|
||||
|
||||
export default DropdownSelectBoxComponent.extend({
|
||||
classNames: ["bulk-select-topics-dropdown"],
|
||||
headerIcon: null,
|
||||
showFullTitle: true,
|
||||
selectKitOptions: {
|
||||
showCaret: true,
|
||||
showFullTitle: true,
|
||||
none: "select_kit.components.bulk_select_topics_dropdown.title",
|
||||
},
|
||||
|
||||
modal: service(),
|
||||
router: service(),
|
||||
|
||||
computeContent() {
|
||||
let options = [];
|
||||
options = options.concat([
|
||||
{
|
||||
id: "update-category",
|
||||
icon: "pencil-alt",
|
||||
name: i18n("topic_bulk_actions.update_category.name"),
|
||||
description: i18n("topic_bulk_actions.update_category.description"),
|
||||
},
|
||||
{
|
||||
id: "close-topics",
|
||||
icon: "lock",
|
||||
name: i18n("topic_bulk_actions.close_topics.name"),
|
||||
},
|
||||
]);
|
||||
return options;
|
||||
},
|
||||
|
||||
@action
|
||||
onSelect(id) {
|
||||
switch (id) {
|
||||
case "update-category":
|
||||
// Temporary: just use the existing modal & action
|
||||
this.modal.show(TopicBulkActions, {
|
||||
model: {
|
||||
topics: this.bulkSelectHelper.selected,
|
||||
category: this.category,
|
||||
refreshClosure: () => this.router.refresh(),
|
||||
initialAction: "set-component",
|
||||
initialComponent: ChangeCategory,
|
||||
},
|
||||
});
|
||||
break;
|
||||
case "close-topics":
|
||||
this.modal.show(BulkTopicActions, {
|
||||
model: {
|
||||
action: "close",
|
||||
title: i18n("topics.bulk.close_topics"),
|
||||
bulkSelectHelper: this.bulkSelectHelper,
|
||||
refreshClosure: () => this.router.refresh(),
|
||||
allowSilent: true,
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
},
|
||||
});
|
|
@ -218,20 +218,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
.d-modal.topic-bulk-actions-modal {
|
||||
.d-modal {
|
||||
&__container {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
p {
|
||||
margin-top: 0;
|
||||
}
|
||||
#bulk-topics-confirm {
|
||||
margin-left: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.d-modal.edit-slow-mode-modal {
|
||||
.slow-mode-label {
|
||||
display: inline-flex;
|
||||
|
|
|
@ -200,22 +200,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
.arrow {
|
||||
border: solid white;
|
||||
border-width: 0 3px 3px 0;
|
||||
display: inline-block;
|
||||
padding: 3px;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.down {
|
||||
transform: rotate(45deg);
|
||||
-webkit-transform: rotate(45deg);
|
||||
}
|
||||
|
||||
.bulk-select-actions {
|
||||
}
|
||||
|
||||
.dismiss-container-top {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
|
|
|
@ -66,8 +66,7 @@ class CurrentUserSerializer < BasicUserSerializer
|
|||
:sidebar_tags,
|
||||
:sidebar_category_ids,
|
||||
:sidebar_sections,
|
||||
:new_new_view_enabled?,
|
||||
:use_experimental_topic_bulk_actions?
|
||||
:new_new_view_enabled?
|
||||
|
||||
delegate :user_stat, to: :object, private: true
|
||||
delegate :any_posts, :draft_count, :pending_posts_count, :read_faq?, to: :user_stat
|
||||
|
@ -278,8 +277,4 @@ class CurrentUserSerializer < BasicUserSerializer
|
|||
def unseen_reviewable_count
|
||||
Reviewable.unseen_reviewable_count(object)
|
||||
end
|
||||
|
||||
def use_experimental_topic_bulk_actions?
|
||||
scope.user.in_any_groups?(SiteSetting.experimental_topic_bulk_actions_enabled_groups_map)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2349,8 +2349,6 @@ en:
|
|||
filter_for_more: Filter for more…
|
||||
categories_admin_dropdown:
|
||||
title: "Manage categories"
|
||||
bulk_select_topics_dropdown:
|
||||
title: "Bulk Actions"
|
||||
|
||||
date_time_picker:
|
||||
from: From
|
||||
|
@ -2888,7 +2886,6 @@ en:
|
|||
topics:
|
||||
new_messages_marker: "last visit"
|
||||
bulk:
|
||||
confirm: "Confirm"
|
||||
select_all: "Select All"
|
||||
clear_all: "Clear All"
|
||||
unlist_topics: "Unlist Topics"
|
||||
|
@ -2947,7 +2944,6 @@ en:
|
|||
progress:
|
||||
one: "Progress: <strong>%{count}</strong> topic"
|
||||
other: "Progress: <strong>%{count}</strong> topics"
|
||||
silent: "Perform this action silently."
|
||||
|
||||
none:
|
||||
unread: "You have no unread topics."
|
||||
|
@ -2979,13 +2975,6 @@ en:
|
|||
bookmarks: "There are no more bookmarked topics."
|
||||
filter: "There are no more topics."
|
||||
|
||||
topic_bulk_actions:
|
||||
close_topics:
|
||||
name: "Close Topics"
|
||||
update_category:
|
||||
name: "Update Category"
|
||||
description: "Choose the new category for the selected topics"
|
||||
|
||||
topic:
|
||||
filter_to:
|
||||
one: "%{count} post in topic"
|
||||
|
|
|
@ -2355,13 +2355,6 @@ developer:
|
|||
default: ""
|
||||
client: true
|
||||
hidden: true
|
||||
experimental_topic_bulk_actions_enabled_groups:
|
||||
default: ""
|
||||
hidden: true
|
||||
type: group_list
|
||||
list_type: compact
|
||||
allow_any: false
|
||||
refresh: true
|
||||
|
||||
navigation:
|
||||
navigation_menu:
|
||||
|
|
|
@ -30,18 +30,6 @@ module PageObjects
|
|||
page.has_no_css?(topic_list_item_class(topic))
|
||||
end
|
||||
|
||||
def has_topic_checkbox?(topic)
|
||||
page.has_css?("#{topic_list_item_class(topic)} input#bulk-select-#{topic.id}")
|
||||
end
|
||||
|
||||
def has_closed_status?(topic)
|
||||
page.has_css?("#{topic_list_item_closed(topic)}")
|
||||
end
|
||||
|
||||
def click_topic_checkbox(topic)
|
||||
find("#{topic_list_item_class(topic)} input#bulk-select-#{topic.id}").click
|
||||
end
|
||||
|
||||
def visit_topic_with_title(title)
|
||||
find("#{TOPIC_LIST_BODY_SELECTOR} a", text: title).click
|
||||
end
|
||||
|
@ -64,10 +52,6 @@ module PageObjects
|
|||
def topic_list_item_class(topic)
|
||||
"#{TOPIC_LIST_ITEM_SELECTOR}[data-topic-id='#{topic.id}']"
|
||||
end
|
||||
|
||||
def topic_list_item_closed(topic)
|
||||
"#{topic_list_item_class(topic)} .topic-statuses .topic-status svg.locked"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module PageObjects
|
||||
module Components
|
||||
class TopicListHeader < PageObjects::Components::Base
|
||||
TOPIC_LIST_HEADER_SELECTOR = ".topic-list .topic-list-header"
|
||||
TOPIC_LIST_DATA_SELECTOR = "#{TOPIC_LIST_HEADER_SELECTOR} .topic-list-data"
|
||||
|
||||
def topic_list_header
|
||||
TOPIC_LIST_HEADER_SELECTOR
|
||||
end
|
||||
|
||||
def has_bulk_select_button?
|
||||
page.has_css?("#{TOPIC_LIST_HEADER_SELECTOR} button.bulk-select")
|
||||
end
|
||||
|
||||
def click_bulk_select_button
|
||||
find("#{TOPIC_LIST_HEADER_SELECTOR} button.bulk-select").click
|
||||
end
|
||||
|
||||
def has_bulk_select_topics_dropdown?
|
||||
page.has_css?(
|
||||
"#{TOPIC_LIST_HEADER_SELECTOR} .bulk-select-topics div.bulk-select-topics-dropdown",
|
||||
)
|
||||
end
|
||||
|
||||
def click_bulk_select_topics_dropdown
|
||||
find(
|
||||
"#{TOPIC_LIST_HEADER_SELECTOR} .bulk-select-topics div.bulk-select-topics-dropdown",
|
||||
).click
|
||||
end
|
||||
|
||||
def has_close_topics_button?
|
||||
page.has_css?(bulk_select_dropdown_item("close-topics"))
|
||||
end
|
||||
|
||||
def click_close_topics_button
|
||||
find(bulk_select_dropdown_item("close-topics")).click
|
||||
end
|
||||
|
||||
def has_bulk_select_modal?
|
||||
page.has_css?("#discourse-modal-title")
|
||||
end
|
||||
|
||||
def click_bulk_topics_confirm
|
||||
find("#bulk-topics-confirm").click
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def bulk_select_dropdown_item(name)
|
||||
"#{TOPIC_LIST_HEADER_SELECTOR} .bulk-select-topics div.bulk-select-topics-dropdown li[data-value='#{name}']"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,41 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe "Topic bulk select", type: :system do
|
||||
before { SiteSetting.experimental_topic_bulk_actions_enabled_groups = "1" }
|
||||
fab!(:topics) { Fabricate.times(10, :post).map(&:topic) }
|
||||
let(:topic_list_header) { PageObjects::Components::TopicListHeader.new }
|
||||
let(:topic_list) { PageObjects::Components::TopicList.new }
|
||||
|
||||
context "when in topic" do
|
||||
fab!(:admin)
|
||||
|
||||
before { sign_in(admin) }
|
||||
|
||||
it "closes multiple topics" do
|
||||
visit("/latest")
|
||||
expect(page).to have_css(".topic-list button.bulk-select")
|
||||
expect(topic_list_header).to have_bulk_select_button
|
||||
|
||||
# Click bulk select button
|
||||
topic_list_header.click_bulk_select_button
|
||||
expect(topic_list).to have_topic_checkbox(topics.first)
|
||||
|
||||
# Select Topics
|
||||
topic_list.click_topic_checkbox(topics.first)
|
||||
topic_list.click_topic_checkbox(topics.second)
|
||||
|
||||
# Has Dropdown
|
||||
expect(topic_list_header).to have_bulk_select_topics_dropdown
|
||||
topic_list_header.click_bulk_select_topics_dropdown
|
||||
|
||||
# Clicking the close button opens up the modal
|
||||
expect(topic_list_header).to have_close_topics_button
|
||||
topic_list_header.click_close_topics_button
|
||||
expect(topic_list_header).to have_bulk_select_modal
|
||||
|
||||
# Closes the selected topics
|
||||
topic_list_header.click_bulk_topics_confirm
|
||||
expect(topic_list).to have_closed_status(topics.first)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue