Skip to content

Commit

Permalink
File actions now always appear in dropdown form
Browse files Browse the repository at this point in the history
Removed the inline file action buttons, they are now always available
under the three dots button.
  • Loading branch information
Vincent Petry committed Feb 5, 2020
1 parent 6e80cdf commit 2530002
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 75 deletions.
35 changes: 11 additions & 24 deletions apps/files/src/components/FileList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
</div>
<slot name="headerColumns"/>
<div
class="uk-text-meta uk-text-right uk-width-auto "
:class="{ 'uk-width-small@s uk-width-medium@m' : !compactMode }"
class="uk-text-meta uk-text-right uk-width-small"
v-translate
>
Actions
Expand Down Expand Up @@ -47,32 +46,20 @@
/>
</div>
<slot name="rowColumns" :item="item" :index="item.id" />
<div :class="{ 'uk-visible@s' : compactMode, 'uk-width-small@s uk-width-medium@m': !compactMode }" class="uk-width-auto uk-text-right">
<div
class="uk-button-group"
:class="{
'uk-visible@m' : !compactMode,
'uk-visible@xl' : compactMode
}"
>
<oc-button
v-for="action in actions"
:key="action.ariaLabel"
@click.stop="action.handler(item, action.handlerData)"
:disabled="!$_isActionEnabled(item, action) || $_actionInProgress(item)"
:icon="action.icon"
:ariaLabel="action.ariaLabel"
:uk-tooltip="$_disabledActionTooltip(item)"
/>
</div>
<div class="uk-width-small uk-text-right uk-margin-small-right">
<oc-button
:id="actionsDropdownButtonId(item.id, active)"
icon="more_vert"
:class="{ 'uk-hidden@m' : !compactMode, 'uk-visible@s uk-hidden@xl' : compactMode }"
:disabled="$_actionInProgress(item)"
:aria-label="'show-file-actions'"
:aria-label="$gettext('Show file actions')"
@click.stop="toggleRowActionsDropdown(item)"
/>
variation="raw"
>
<oc-icon
name="more_vert"
class="uk-text-middle"
size="small"
/>
</oc-button>
</div>
</oc-grid>
</div>
Expand Down
69 changes: 18 additions & 51 deletions tests/acceptance/pageObjects/FilesPageElement/filesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,18 @@ const FileAction = Object.freeze({
module.exports = {
commands: {
/**
* Action button selector for Low Resolution screens
* Action button selector
*
* @param {string} action
* @param {string} fileName
* @returns {string}
*/
getActionSelectorLowRes: function (action) {
getActionSelector: function (action) {
const actionsDropdownSelector = this.elements.itemActionsDropdown.selector
const actionSelector = this.elements[action + 'ButtonInFileRow'].selector

return `${actionsDropdownSelector}${actionSelector}`
},
/**
* Action button selector for High Resolution screens
*
* @param {string} action
* @param {string} fileName
* @returns {string}
*/
getActionSelectorHighRes: function (action, fileName) {
return '(' + this.getFileRowSelectorByFileName(fileName) +
this.elements[action + 'ButtonInFileRow'].selector + ')[1]'
},
/**
* Get Selector for File Actions expander
*
Expand All @@ -60,22 +49,16 @@ module.exports = {
* @returns {*}
*/
performFileAction: function (fileName, action) {
const { btnSelectorHighResolution, btnSelectorLowResolution, fileActionsBtnSelector } =
const { btnSelector, fileActionsBtnSelector } =
this.getFileRowButtonSelectorsByFileName(fileName, action)

return this.initAjaxCounters()
.useXpath()
.isVisible(fileActionsBtnSelector, (result) => {
if (result.value === true) {
this
.click(fileActionsBtnSelector)
.waitForElementVisible(btnSelectorLowResolution)
.click(btnSelectorLowResolution)
} else {
this
.waitForElementVisible(btnSelectorHighResolution)
.click(btnSelectorHighResolution)
}
this
.click(fileActionsBtnSelector)
.waitForElementVisible(btnSelector)
.click(btnSelector)
})
},

Expand All @@ -89,21 +72,14 @@ module.exports = {
* @returns {*}
*/
isActionDisabled: function (fileName, action, callback) {
const { btnSelectorHighResolution, btnSelectorLowResolution, fileActionsBtnSelector } =
const { btnSelector, fileActionsBtnSelector } =
this.getFileRowButtonSelectorsByFileName(fileName, action)

return this
.useXpath()
.moveToElement(this.getFileRowSelectorByFileName(fileName), 0, 0)
.isVisible(fileActionsBtnSelector, (result) => {
let btnSelector
if (result.value === true) {
this
.click(fileActionsBtnSelector)
btnSelector = btnSelectorLowResolution
} else {
btnSelector = btnSelectorHighResolution
}
this.click(fileActionsBtnSelector)

this
.waitForElementVisible(btnSelector)
Expand Down Expand Up @@ -453,11 +429,10 @@ module.exports = {
.useCss()
},
getFileRowButtonSelectorsByFileName: function (fileName, action) {
const btnSelectorHighResolution = this.getActionSelectorHighRes(action, fileName)
const btnSelectorLowResolution = this.getActionSelectorLowRes(action, fileName)
const btnSelector = this.getActionSelector(action, fileName)
const fileActionsBtnSelector = this.getFileActionBtnSelector(fileName)

return { btnSelectorHighResolution, btnSelectorLowResolution, fileActionsBtnSelector }
return { btnSelector, fileActionsBtnSelector }
},
/**
*
Expand Down Expand Up @@ -587,26 +562,18 @@ module.exports = {
* @returns {Promise<boolean>}
*/
getActionDisabledAttr: async function (action, fileName) {
const btnSelectorHighResolution = this.getActionSelectorHighRes(action, fileName)
const btnSelectorLowResolution = this.getActionSelectorLowRes(action, fileName)
const btnSelector = this.getActionSelector(action, fileName)
const fileActionsBtnSelector = this.getFileActionBtnSelector(fileName)
let disabledState
await this
.useXpath()
.moveToElement(this.getFileRowSelectorByFileName(fileName), 0, 0)
.isVisible(fileActionsBtnSelector, (result) => {
if (result.value === true) {
this.click(fileActionsBtnSelector)
.waitForElementVisible(btnSelectorLowResolution)
.getAttribute(btnSelectorLowResolution, 'disabled', result => {
disabledState = result.value
})
} else {
this.waitForElementVisible(btnSelectorHighResolution)
.getAttribute(btnSelectorHighResolution, 'disabled', result => {
disabledState = result.value
})
}
this.click(fileActionsBtnSelector)
.waitForElementVisible(btnSelector)
.getAttribute(btnSelector, 'disabled', result => {
disabledState = result.value
})
})
.useCss()
return disabledState
Expand Down Expand Up @@ -843,7 +810,7 @@ module.exports = {
selector: '#files-list-progress'
},
fileActionsButtonInFileRow: {
selector: '//button[@aria-label="show-file-actions"]',
selector: '//button[@aria-label="Show file actions"]',
locateStrategy: 'xpath'
},
deleteFileConfirmationDialog: {
Expand Down

0 comments on commit 2530002

Please sign in to comment.