55990: Add move item component

This commit is contained in:
Yana De Pauw
2018-11-26 16:28:39 +01:00
parent d26bba8e14
commit 4411c312e5
9 changed files with 256 additions and 17 deletions

View File

@@ -0,0 +1,44 @@
import {ItemOperation} from './itemOperation.model';
import {async, TestBed} from '@angular/core/testing';
import {ItemOperationComponent} from './item-operation.component';
import {TranslateModule} from '@ngx-translate/core';
import {By} from '@angular/platform-browser';
describe('ItemOperationComponent', () => {
const itemOperation: ItemOperation = new ItemOperation('key1', 'url1');
let fixture;
let comp;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot()],
declarations: [ItemOperationComponent]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ItemOperationComponent);
comp = fixture.componentInstance;
comp.operation = itemOperation;
fixture.detectChanges();
});
it('should render operation row', () => {
const span = fixture.debugElement.query(By.css('span')).nativeElement;
expect(span.textContent).toContain('item.edit.tabs.status.buttons.key1.label');
const link = fixture.debugElement.query(By.css('a')).nativeElement;
expect(link.href).toContain('url1');
expect(link.textContent).toContain('item.edit.tabs.status.buttons.key1.button');
});
it('should render disabled operation row', () => {
itemOperation.setDisabled(true);
fixture.detectChanges();
const span = fixture.debugElement.query(By.css('span')).nativeElement;
expect(span.textContent).toContain('item.edit.tabs.status.buttons.key1.label');
const span2 = fixture.debugElement.query(By.css('span.btn-danger')).nativeElement;
expect(span2.textContent).toContain('item.edit.tabs.status.buttons.key1.button');
});
});