Skip to content

Commit

Permalink
Enable autoPlay as opt-in. Documentation. (#48)
Browse files Browse the repository at this point in the history
* Enable `autoPlay` as opt-in. Documentation.

* Changelog

* Fix cypress

* Fix test

* What about now

* Fix again
  • Loading branch information
sneridagh committed Mar 7, 2024
1 parent ab4f206 commit acdd040
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push]
env:
ADDON_NAME: "@kitconcept/volto-slider-block"
ADDON_PATH: "volto-slider-block"
VOLTO_VERSION: "17.6.0"
VOLTO_VERSION: "17.15.3"

jobs:

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RESET=`tput sgr0`
YELLOW=`tput setaf 3`

PLONE_VERSION=6
VOLTO_VERSION=17.7.0
VOLTO_VERSION=17.15.3

ADDON_NAME='@kitconcept/volto-slider-block'
ADDON_PATH='volto-slider-block'
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ yarn start

Go to http://localhost:3000, login, create a new page. The slider block will show up in the Volto blocks chooser.

## Configuration options

### `enableAutoPlay`

This enables the autoplay controls in the block's settings.

```js
config.blocks.blocksConfig.slider.enableAutoPlay = true;
```

## Upgrade Guide

### `volto-slider-block` 6.0.0
Expand Down
2 changes: 2 additions & 0 deletions acceptance/cypress/tests/block.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ context('Block Acceptance Tests', () => {
cy.get(
'.objectbrowser-field[aria-labelledby="fieldset-default-field-label-href-0-slides-1"] button[aria-label="Open object browser"]',
).click();
cy.wait(1000);
cy.get('aside .breadcrumbs svg.home-icon').click();
cy.findByLabelText('Select My Page').dblclick();

Expand Down Expand Up @@ -87,6 +88,7 @@ context('Block Acceptance Tests', () => {
cy.get(
'.objectbrowser-field[aria-labelledby="fieldset-default-field-label-href-0-slides-1"] button[aria-label="Open object browser"]',
).click();
cy.wait(1000);
cy.get('aside .breadcrumbs svg.home-icon').click();
cy.findByLabelText('Select My Page').dblclick();

Expand Down
1 change: 1 addition & 0 deletions news/48.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Enable autoPlay as opt-in. Documentation @sneridagh
14 changes: 9 additions & 5 deletions src/components/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,15 @@ export const SliderSchema = (props) =>
title: 'Default',
fields: ['slides'],
},
{
id: 'autoplay',
title: props.intl.formatMessage(messages.Autoplay),
fields: ['autoplayEnabled', 'autoplayDelay', 'autoplayJump'],
},
...(config.blocks.blocksConfig.slider.enableAutoPlay
? [
{
id: 'autoplay',
title: props.intl.formatMessage(messages.Autoplay),
fields: ['autoplayEnabled', 'autoplayDelay', 'autoplayJump'],
},
]
: []),
],
properties: {
slides: {
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const applyConfig = (config) => {
mostUsed: true,
sidebarTab: 1,
dataAdapter: SliderBlockDataAdapter,
enableAutoPlay: false,
};
return config;
};
Expand Down

0 comments on commit acdd040

Please sign in to comment.