[ADF-3591] spellcheck support for code (#3827)

* setup spellcheck
This commit is contained in:
Denys Vuika
2018-10-23 15:05:38 +01:00
committed by Eugenio Romano
parent 53d96679ea
commit e39a2b149b
262 changed files with 1561 additions and 1005 deletions

View File

@@ -23,6 +23,7 @@ import { HighlightDirective } from './highlight.directive';
import { setupTestBed } from '../testing/setupTestBed';
import { CoreModule } from '../core.module';
/* spellchecker: disable */
const template: string = `
<div id="outerDiv1" adf-highlight adf-highlight-selector=".highlightable" adf-highlight-class="highlight-for-free-willy">
<div id="innerDiv11" class="highlightable">Lorem ipsum salana-eyong-aysis dolor sit amet</div>
@@ -36,7 +37,7 @@ const template: string = `
@Component({ selector: 'adf-test-component', template })
class TestComponent {
@ViewChildren(HighlightDirective) public hightlightDirectives;
@ViewChildren(HighlightDirective) public highlightDirectives;
}
describe('HighlightDirective', () => {
@@ -59,8 +60,8 @@ describe('HighlightDirective', () => {
fixture.detectChanges();
});
it('should replace the searched text with the default hightlight class in the proper element (adf-highlight-selector)', () => {
component.hightlightDirectives.last.highlight('salana-eyong-aysis');
it('should replace the searched text with the default highlight class in the proper element (adf-highlight-selector)', () => {
component.highlightDirectives.last.highlight('salana-eyong-aysis');
fixture.detectChanges();
const containerElement = fixture.debugElement.query(By.css('#innerDiv21'));
@@ -68,8 +69,8 @@ describe('HighlightDirective', () => {
expect(containerElement.nativeElement.innerHTML).toBe('Lorem ipsum <span class="adf-highlight">salana-eyong-aysis</span> dolor sit amet');
});
it('should replace the searched text with the default hightlight class in every proper element (highlight-for-free-willy)', () => {
component.hightlightDirectives.first.highlight('salana-eyong-aysis');
it('should replace the searched text with the default highlight class in every proper element (highlight-for-free-willy)', () => {
component.highlightDirectives.first.highlight('salana-eyong-aysis');
fixture.detectChanges();
const containerElement1 = fixture.debugElement.query(By.css('#innerDiv11'));
@@ -81,7 +82,7 @@ describe('HighlightDirective', () => {
});
it('should NOT replace the searched text in an element without the proper selector class', () => {
component.hightlightDirectives.first.highlight('salana-eyong-aysis');
component.highlightDirectives.first.highlight('salana-eyong-aysis');
fixture.detectChanges();
const containerElement1 = fixture.debugElement.query(By.css('#innerDiv12'));
@@ -92,7 +93,7 @@ describe('HighlightDirective', () => {
it('should NOT reinsert the same text to the innerText if there was no change at all (search string is not found)', () => {
const highlighter = TestBed.get(HighlightTransformService);
spyOn(highlighter, 'highlight').and.returnValue({ changed: false, text: 'Modified text' });
component.hightlightDirectives.first.highlight('salana-eyong-aysis');
component.highlightDirectives.first.highlight('salana-eyong-aysis');
fixture.detectChanges();
const containerElement = fixture.debugElement.query(By.css('#innerDiv11'));
@@ -103,7 +104,7 @@ describe('HighlightDirective', () => {
it('should do the search only if there is a search string presented', () => {
const highlighter = TestBed.get(HighlightTransformService);
spyOn(highlighter, 'highlight').and.callThrough();
component.hightlightDirectives.first.highlight('');
component.highlightDirectives.first.highlight('');
fixture.detectChanges();
expect(highlighter.highlight).not.toHaveBeenCalled();
@@ -114,7 +115,7 @@ describe('HighlightDirective', () => {
spyOn(highlighter, 'highlight').and.callThrough();
const callback = function() {
component.hightlightDirectives.first.highlight('raddish', '');
component.highlightDirectives.first.highlight('raddish', '');
fixture.detectChanges();
};

View File

@@ -18,7 +18,7 @@
/* tslint:disable:no-input-rename */
import { Directive, ElementRef, Input, Renderer2 } from '@angular/core';
import { HighlightTransformService, HightlightTransformResult } from '../services/highlight-transform.service';
import { HighlightTransformService, HighlightTransformResult } from '../services/highlight-transform.service';
@Directive({
selector: '[adf-highlight]'
@@ -47,7 +47,7 @@ export class HighlightDirective {
const elements = this.el.nativeElement.querySelectorAll(selector);
elements.forEach((element) => {
const result: HightlightTransformResult = this.highlightTransformService.highlight(element.innerHTML, search, classToApply);
const result: HighlightTransformResult = this.highlightTransformService.highlight(element.innerHTML, search, classToApply);
if (result.changed) {
this.renderer.setProperty(element, 'innerHTML', result.text);
}

View File

@@ -128,11 +128,11 @@ describe('LogoutDirective', () => {
});
describe('enabelRedirect', () => {
describe('enableRedirect', () => {
@Component({
selector: 'adf-test-component',
template: '<button adf-logout [enabelRedirect]="false"></button>'
template: '<button adf-logout [enableRedirect]="false"></button>'
})
class TestComponent {
@ContentChildren(LogoutDirective)
@@ -160,7 +160,7 @@ describe('LogoutDirective', () => {
fixture.detectChanges();
});
it('should not redirect if enabelRedirect is false', () => {
it('should not redirect if enableRedirect is false', () => {
spyOn(router, 'navigate');
spyOn(authService, 'logout').and.returnValue(of(true));
const button = fixture.nativeElement.querySelector('button');

View File

@@ -30,7 +30,7 @@ export class LogoutDirective implements OnInit {
/** Enable redirect after logout */
@Input()
enabelRedirect: boolean = true;
enableRedirect: boolean = true;
constructor(private elementRef: ElementRef,
private renderer: Renderer2,
@@ -55,7 +55,7 @@ export class LogoutDirective implements OnInit {
}
redirectToUri() {
if (this.enabelRedirect) {
if (this.enableRedirect) {
this.router.navigate([this.redirectUri]);
}
}

View File

@@ -58,7 +58,7 @@ export class NodePermissionDirective implements OnChanges {
}
/**
* Updates disabled state for the decorated elememtn
* Updates disabled state for the decorated element
*
* @memberof NodePermissionDirective
*/

View File

@@ -80,10 +80,10 @@ export class NodeRestoreDirective {
mergeMap(() => this.getDeletedNodes())
)
.subscribe(deletedNodesList => {
const { entries: nodelist } = deletedNodesList.list;
const { entries: nodeList } = deletedNodesList.list;
const { fail: restoreErrorNodes } = this.restoreProcessStatus;
const selectedNodes = this.diff(restoreErrorNodes, selection, false);
const remainingNodes = this.diff(selectedNodes, nodelist);
const remainingNodes = this.diff(selectedNodes, nodeList);
if (!remainingNodes.length) {
this.notification();

View File

@@ -140,9 +140,9 @@ export class UploadDirective implements OnInit, OnDestroy {
this.element.classList.remove(this.cssClassName);
this.isDragging = false;
const dataTranfer = this.getDataTransfer(event);
if (dataTranfer) {
this.getFilesDropped(dataTranfer).then(files => {
const dataTransfer = this.getDataTransfer(event);
if (dataTransfer) {
this.getFilesDropped(dataTransfer).then(files => {
this.onUploadFiles(files);
});
@@ -211,7 +211,7 @@ export class UploadDirective implements OnInit, OnDestroy {
}));
} else if (item.isDirectory) {
iterations.push(new Promise(resolveFolder => {
FileUtils.flattern(item).then(files => resolveFolder(files));
FileUtils.flatten(item).then(files => resolveFolder(files));
}));
}
}