mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
parent
147af98bda
commit
2e58481f15
@ -152,5 +152,51 @@ describe('AlfrescoSearchControlComponent', () => {
|
||||
|
||||
});
|
||||
|
||||
describe('component focus', () => {
|
||||
|
||||
it('should fire an event when the search box receives focus', () => {
|
||||
spyOn(component.expand, 'emit');
|
||||
let inputEl = element.querySelector('input');
|
||||
inputEl.dispatchEvent(new Event('focus'));
|
||||
expect(component.expand.emit).toHaveBeenCalledWith({
|
||||
expanded: true
|
||||
});
|
||||
});
|
||||
|
||||
it('should fire an event when the search box loses focus', () => {
|
||||
spyOn(component.expand, 'emit');
|
||||
let inputEl = element.querySelector('input');
|
||||
inputEl.dispatchEvent(new Event('blur'));
|
||||
expect(component.expand.emit).toHaveBeenCalledWith({
|
||||
expanded: false
|
||||
});
|
||||
});
|
||||
|
||||
it('should NOT fire an event when the search box receives/loses focus but the component is not expandable',
|
||||
() => {
|
||||
spyOn(component.expand, 'emit');
|
||||
component.expandable = false;
|
||||
let inputEl = element.querySelector('input');
|
||||
inputEl.dispatchEvent(new Event('focus'));
|
||||
inputEl.dispatchEvent(new Event('blur'));
|
||||
expect(component.expand.emit).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('file preview', () => {
|
||||
|
||||
it('should emit a preview event when onFileClicked is called', () => {
|
||||
spyOn(component.preview, 'emit');
|
||||
component.onFileClicked({
|
||||
value: 'node12345'
|
||||
});
|
||||
expect(component.preview.emit).toHaveBeenCalledWith({
|
||||
'value': 'node12345'
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user