Ban xit and xdescribe use in the future (#4923)

* remove xit test and ban xit and xdescribe use in the future

* remove xit test and ban xit and xdescribe use in the future

* remove test excluded

* remove consecutive blank line
This commit is contained in:
Eugenio Romano
2019-07-12 15:04:53 +01:00
committed by GitHub
parent 07213fac3a
commit b28a53afe7
28 changed files with 7 additions and 893 deletions

View File

@@ -108,31 +108,6 @@ describe('DropdownBreadcrumb', () => {
});
});
xit('should display the path in reverse order', (done) => {
const fakeNodeWithCreatePermissionInstance = JSON.parse(JSON.stringify(fakeNodeWithCreatePermission));
fakeNodeWithCreatePermissionInstance.path.elements = [
{ id: '1', name: 'Stark Industries' },
{ id: '2', name: 'User Homes' },
{ id: '3', name: 'J.A.R.V.I.S' }
];
triggerComponentChange(fakeNodeWithCreatePermissionInstance);
fixture.whenStable().then(() => {
openSelect();
fixture.whenStable().then(() => {
const options = fixture.debugElement.queryAll(By.css('[data-automation-class="dropdown-breadcrumb-path-option"]'));
expect(options.length).toBe(3);
expect(options[0].nativeElement.innerText.trim()).toBe('J.A.R.V.I.S');
expect(options[1].nativeElement.innerText.trim()).toBe('User Homes');
expect(options[2].nativeElement.innerText.trim()).toBe('Stark Industries');
done();
});
});
});
it('should emit navigation event when clicking on an option', (done) => {
const fakeNodeWithCreatePermissionInstance = JSON.parse(JSON.stringify(fakeNodeWithCreatePermission));
fakeNodeWithCreatePermissionInstance.path.elements = [{ id: '1', name: 'Stark Industries' }];

View File

@@ -40,7 +40,6 @@ class TestComponent {
describe('FolderEditDirective', () => {
let fixture: ComponentFixture<TestComponent>;
let element;
let node: any;
let dialog: MatDialog;
let contentService: ContentService;
let dialogRefMock;
@@ -68,8 +67,6 @@ describe('FolderEditDirective', () => {
});
beforeEach(() => {
node = { entry: { id: 'folderId' } };
dialogRefMock = {
afterClosed: (val) => of(val),
componentInstance: {
@@ -81,18 +78,6 @@ describe('FolderEditDirective', () => {
spyOn(dialog, 'open').and.returnValue(dialogRefMock);
});
xit('should emit folderEdit event when input value is not undefined', (done) => {
spyOn(dialogRefMock, 'afterClosed').and.returnValue(of(node));
contentService.folderEdit.subscribe((val) => {
expect(val).toBe(node);
done();
});
element.triggerEventHandler('click', event);
fixture.detectChanges();
});
it('should not emit folderEdit event when input value is undefined', () => {
spyOn(dialogRefMock, 'afterClosed').and.returnValue(of(null));
spyOn(contentService.folderEdit, 'next');

View File

@@ -227,23 +227,6 @@ describe('SearchControlComponent', () => {
expect(element.querySelector('#adf-control-input').getAttribute('autocomplete')).toBe('on');
}));
xit('should fire a search when a enter key is pressed', (done) => {
const searchDisposable = component.submit.subscribe((value) => {
expect(value).toBe('TEST');
searchDisposable.unsubscribe();
done();
});
spyOn(component, 'isSearchBarActive').and.returnValue(true);
searchServiceSpy.and.returnValue(of(JSON.parse(JSON.stringify(results))));
fixture.detectChanges();
const inputDebugElement = debugElement.query(By.css('#adf-control-input'));
typeWordIntoSearchInput('TEST');
const enterKeyEvent: any = new Event('keyup');
enterKeyEvent.keyCode = '13';
inputDebugElement.nativeElement.dispatchEvent(enterKeyEvent);
});
});
describe('autocomplete list', () => {
@@ -408,67 +391,6 @@ describe('SearchControlComponent', () => {
});
});
xit('should select the first item on autocomplete list when ARROW DOWN is pressed on input', (done) => {
searchServiceSpy.and.returnValue(of(JSON.parse(JSON.stringify(results))));
fixture.detectChanges();
typeWordIntoSearchInput('TEST');
const inputDebugElement = debugElement.query(By.css('#adf-control-input'));
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(element.querySelector('#autocomplete-search-result-list')).not.toBeNull();
inputDebugElement.triggerEventHandler('keyup.arrowdown', {});
fixture.detectChanges();
expect(document.activeElement.id).toBe('result_option_0');
done();
});
});
xit('should select the second item on autocomplete list when ARROW DOWN is pressed on list', (done) => {
searchServiceSpy.and.returnValue(of(JSON.parse(JSON.stringify(results))));
fixture.detectChanges();
const inputDebugElement = debugElement.query(By.css('#adf-control-input'));
typeWordIntoSearchInput('TEST');
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(element.querySelector('#autocomplete-search-result-list')).not.toBeNull();
inputDebugElement.triggerEventHandler('keyup.arrowdown', {});
fixture.detectChanges();
expect(document.activeElement.id).toBe('result_option_0');
const firstElement = debugElement.query(By.css('#result_option_0'));
firstElement.triggerEventHandler('keyup.arrowdown', { target: firstElement.nativeElement });
fixture.detectChanges();
expect(document.activeElement.id).toBe('result_option_1');
done();
});
});
xit('should focus the input search when ARROW UP is pressed on the first list item', (done) => {
searchServiceSpy.and.returnValue(of(JSON.parse(JSON.stringify(results))));
fixture.detectChanges();
const inputDebugElement = debugElement.query(By.css('#adf-control-input'));
typeWordIntoSearchInput('TEST');
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(element.querySelector('#autocomplete-search-result-list')).not.toBeNull();
inputDebugElement.triggerEventHandler('keyup.arrowdown', {});
fixture.detectChanges();
expect(document.activeElement.id).toBe('result_option_0');
const firstElement = debugElement.query(By.css('#result_option_0'));
firstElement.triggerEventHandler('keyup.arrowup', { target: firstElement.nativeElement });
fixture.detectChanges();
expect(document.activeElement.id).toBe('adf-control-input');
done();
});
});
});
describe('search button', () => {
@@ -515,24 +437,6 @@ describe('SearchControlComponent', () => {
discardPeriodicTasks();
}));
xit('click on the search button should apply focus on input', fakeAsync(() => {
fixture.detectChanges();
tick(100);
const searchButton: DebugElement = debugElement.query(By.css('#adf-search-button'));
searchButton.triggerEventHandler('click', null);
const inputDebugElement = debugElement.query(By.css('#adf-control-input'));
tick(100);
fixture.detectChanges();
tick(100);
expect(document.activeElement.id).toBe(inputDebugElement.nativeElement.id);
discardPeriodicTasks();
}));
it('Search button should not change the input state too often', fakeAsync(() => {
fixture.detectChanges();

View File

@@ -17,11 +17,7 @@
import { SearchDateRangeComponent } from './search-date-range.component';
import { of } from 'rxjs';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ContentTestingModule } from '../../../testing/content.testing.module';
import { setupTestBed, MomentDateAdapter } from '@alfresco/adf-core';
import { By } from '@angular/platform-browser';
import { TranslateService } from '@ngx-translate/core';
import { MomentDateAdapter } from '@alfresco/adf-core';
declare let moment: any;
@@ -156,48 +152,4 @@ describe('SearchDateRangeComponent', () => {
});
});
describe('component DOM', () => {
let component: SearchDateRangeComponent;
let fixture: ComponentFixture<SearchDateRangeComponent>;
let translateService: TranslateService;
let translationSpy: jasmine.Spy;
const dateFormatFixture = 'DD MMM YYYY';
setupTestBed({
imports: [ContentTestingModule]
});
beforeEach(() => {
fixture = TestBed.createComponent(SearchDateRangeComponent);
component = fixture.componentInstance;
translateService = TestBed.get(TranslateService);
translationSpy = spyOn(translateService, 'get').and.callFake((key) => {
return of(key);
});
component.settings = { 'dateFormat': dateFormatFixture, field: 'cm:created' };
fixture.detectChanges();
});
afterEach(() => {
fixture.destroy();
});
xit('should display the required format when input date is invalid', () => {
const inputEl = fixture.debugElement.query(By.css('input')).nativeElement;
inputEl.value = 'invalid-date';
inputEl.dispatchEvent(new Event('input'));
fixture.detectChanges();
inputEl.dispatchEvent(new Event('blur'));
fixture.detectChanges();
expect(translationSpy.calls.mostRecent().args)
.toEqual(['SEARCH.FILTER.VALIDATION.INVALID-DATE', { requiredFormat: dateFormatFixture }]);
inputEl.value = '';
fixture.detectChanges();
});
});
});

View File

@@ -234,33 +234,6 @@ describe('SearchQueryBuilder', () => {
expect(field.field).toBe('content.size');
});
xit('should build query and raise an event on update', async () => {
const builder = new SearchQueryBuilderService(buildConfig({}), null);
const query = {};
spyOn(builder, 'buildQuery').and.returnValue(query);
let eventArgs;
builder.updated.subscribe((args) => eventArgs = args);
await builder.execute();
expect(eventArgs).toBe(query);
});
xit('should build query and raise an event on execute', async () => {
const data = {};
const api = jasmine.createSpyObj('api', ['search']);
api.search.and.returnValue(data);
const builder = new SearchQueryBuilderService(buildConfig({}), api);
spyOn(builder, 'buildQuery').and.returnValue({});
let eventArgs;
builder.executed.subscribe((args) => eventArgs = args);
await builder.execute();
expect(eventArgs).toBe(data);
});
it('should require a query fragment to build query', () => {
const config: SearchConfiguration = {
categories: [

View File

@@ -131,24 +131,6 @@ describe('WebscriptComponent', () => {
});
});
xit('HTML response should be displayed', (done) => {
component.scriptPath = 'sample/folder/Company%20Home';
component.contentType = 'HTML';
component.ngOnChanges(null).then(() => {
fixture.detectChanges();
expect(element.querySelector('#webscript-data-HTML').innerHTML)
.toBe('&lt;test-element-id&gt;&lt;test-elemt-id&gt;');
done();
});
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'text/html',
responseText: '<test-element-id><test-elemt-id>'
});
});
it('datatable response should be displayed', (done) => {
// reset MDL handler
window['componentHandler'] = null;