Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpeedDialAction: Provide elementAttr from SDA to Overlay (T1140620) #23792

Merged
merged 1 commit into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 29 additions & 26 deletions js/ui/speed_dial_action/speed_dial_main_item.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,48 @@ let speedDialMainItem = null;

const modifyActionOptions = (action) => {
const {
icon,
onClick,
label,
visible,
index,
onContentReady,
activeStateEnabled,
hoverStateEnabled,
animation,
id,
actions,
actionComponent,
actionVisible,
zIndex,
position,
actions,
activeStateEnabled,
direction,
elementAttr,
hint,
hoverStateEnabled,
icon,
id,
index,
label,
onClick,
onContentReady,
parentPosition,
direction
position,
visible,
zIndex,
} = action.option();

return extend({}, {
icon,
onClick,
label,
visible,
index,
onContentReady,
activeStateEnabled,
hoverStateEnabled,
animation,
id,
actions,
actionComponent,
actionVisible,
zIndex,
position,
actions,
activeStateEnabled,
direction,
elementAttr,
hint,
hoverStateEnabled,
icon,
id,
index,
label,
onClick,
onContentReady,
parentPosition,
direction
position,
visible,
zIndex,
_ignoreElementAttrDeprecation: true,
}, {
onInitialized: null,
onDisposing: null
Expand Down
20 changes: 20 additions & 0 deletions testing/tests/DevExpress.ui.widgets/speedDialAction.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,26 @@ QUnit.module('add visible option', {
});


QUnit.test('Overlay element should contain attrs provided with "elementAttr" from SpeedDialAction (T1140620)', function(assert) {
this.firstSDA = $('#fab-one').dxSpeedDialAction({
icon: 'add',
elementAttr: {
class: 'custom-class',
'data-test': true,
},
}).dxSpeedDialAction('instance');

const $fabElement = this.firstSDA.$element();
const $overlayElement = $(FAB_MAIN_SELECTOR);

assert.ok($fabElement.hasClass('custom-class'), 'FAB element has correct custom class');
assert.ok($overlayElement.hasClass('custom-class'), 'Overlay element has correct custom class');

assert.ok($fabElement.attr('data-test'), 'FAB element has correct data-test attribute');
assert.ok($overlayElement.attr('data-test'), 'Overlay element has correct data-test attribute');
});


QUnit.test('check label rendering before/after toggling visibility (T985992)', function(assert) {
this.firstSDA = $('#fab-one').dxSpeedDialAction({
icon: 'add',
Expand Down