Skip to content

Commit bb54ece

Browse files
fix user supplied attributes (#388)
1 parent dd4b12f commit bb54ece

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

addon/components/attach-popover.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ export default class AttachPopover extends Component {
262262
super.didReceiveAttrs(...arguments);
263263

264264
stripInProduction(() => {
265-
const attrs = this.attributes || {};
265+
// eslint-disable-next-line ember/no-attrs-in-components
266+
const attrs = this.attrs || {};
266267
const userDefaults = this._config;
267268

268269
let arrow;
@@ -312,7 +313,8 @@ export default class AttachPopover extends Component {
312313
return;
313314
}
314315

315-
const attrs = this.attributes || {};
316+
// eslint-disable-next-line ember/no-attrs-in-components
317+
const attrs = this.attrs || {};
316318

317319
for (const key in userDefaults) {
318320
stripInProduction(() => {

tests/integration/components/ember-attacher/ember-attacher-test.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,34 @@ module('Integration | Component | ember attacher', function(hooks) {
2525
assert.ok(attachment.innerHTML.includes('popper text'));
2626
});
2727

28+
test('uses the user-supplied popover class over global config class', async function(assert) {
29+
this.owner.resolveRegistration('config:environment').emberAttacher = {
30+
class: 'different-default'
31+
};
32+
33+
await render(hbs`
34+
<div id="target">
35+
{{#attach-popover id='attachment' class='some-class some-other-class'}}
36+
tooltip text
37+
{{/attach-popover}}
38+
</div>
39+
`);
40+
41+
const popover = find('#attachment > .some-class');
42+
43+
assert.contains(
44+
popover.className.split(' '),
45+
[
46+
'ember-attacher-fill',
47+
'some-class',
48+
'some-other-class',
49+
'ember-attacher-hide',
50+
'ember-attacher-without-arrow'
51+
],
52+
'it adds the user-supplied default classes'
53+
);
54+
});
55+
2856
test('uses the user-supplied default popover class - separate config', async function(assert) {
2957
assert.expect(1);
3058

0 commit comments

Comments
 (0)