Skip to content

Commit

Permalink
chore(popup-menu): add titles to all elements
Browse files Browse the repository at this point in the history
Allows users to inspect truncated items.
  • Loading branch information
nikku committed Dec 7, 2022
1 parent 8eaef1b commit 103b4c8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/features/popup-menu/PopupMenuComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export default function PopupMenuComponent(props) {
>
${ displayHeader && html`
<div class="djs-popup-header">
<h3 class="djs-popup-title">${ title }</h3>
<h3 class="djs-popup-title" title=${ title }>${ title }</h3>
${ headerEntries.map(entry => html`
<span
class=${ getHeaderClasses(entry, entry === selectedEntry) }
Expand Down
2 changes: 1 addition & 1 deletion lib/features/popup-menu/PopupMenuList.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function PopupMenuList(props) {
<div class="djs-popup-results" ref=${ resultsRef }>
${ groups.map(group => html`
${ group.name && html`
<div key=${ group.id } class="entry-header">
<div key=${ group.id } class="entry-header" title=${ group.name }>
${ group.name }
</div>
` }
Expand Down
30 changes: 29 additions & 1 deletion test/spec/features/popup-menu/PopupMenuComponentSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,34 @@ describe('features/popup-menu - <PopupMenu>', function() {
expect(describedEntry.textContent).to.eql('FOOI DESCRIBE IT');
}));


it('should render entry header', inject(function() {

// given
const entries = [
{
id: '1',
label: '1',
group: {
id: 'SAD',
name: 'SOME GROUP'
}
}
];

createPopupMenu({ container, entries });

// when
const [
groupHeader
] = domQueryAll('.entry-header', container);

// then
expect(groupHeader).to.exist;
expect(groupHeader.title).to.eql('SOME GROUP');
expect(groupHeader.textContent).to.eql('SOME GROUP');
}));

});


Expand Down Expand Up @@ -404,8 +432,8 @@ describe('features/popup-menu - <PopupMenu>', function() {
// then
var titleElement = domQuery('.djs-popup-title', container);
expect(titleElement).to.exist;
expect(titleElement.title).to.eql(title);
expect(titleElement.innerHTML).to.eql(title);

}));


Expand Down

0 comments on commit 103b4c8

Please sign in to comment.