mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
#150 Safety-commit before moving to "shared" package
This commit is contained in:
8
dspace-angular.iml
Normal file
8
dspace-angular.iml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" name="node_modules" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
@@ -0,0 +1,52 @@
|
|||||||
|
import { ObjectCollectionComponent } from './object-collection.component';
|
||||||
|
import { ViewMode } from '../+search-page/search-options.model';
|
||||||
|
import { element } from 'protractor';
|
||||||
|
import { By } from '@angular/platform-browser';
|
||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
import { Config } from '../../config/config.interface';
|
||||||
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
import { RouterStub } from '../shared/testing/router-stub';
|
||||||
|
|
||||||
|
describe('ObjectCollectionComponent', () => {
|
||||||
|
let fixture: ComponentFixture<ObjectCollectionComponent>;
|
||||||
|
let objectCollectionComponent: ObjectCollectionComponent;
|
||||||
|
const queryParam = 'test query';
|
||||||
|
const scopeParam = '7669c72a-3f2a-451f-a3b9-9210e7a4c02f';
|
||||||
|
const activatedRouteStub = {
|
||||||
|
queryParams: Observable.of({
|
||||||
|
query: queryParam,
|
||||||
|
scope: scopeParam
|
||||||
|
})
|
||||||
|
};
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ ObjectCollectionComponent ],
|
||||||
|
providers: [
|
||||||
|
{ provide: ActivatedRoute, useValue: activatedRouteStub },
|
||||||
|
{ provide: Router, useClass: RouterStub }
|
||||||
|
],
|
||||||
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
|
}).compileComponents(); // compile template and css
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
fixture = TestBed.createComponent(ObjectCollectionComponent);
|
||||||
|
objectCollectionComponent = fixture.componentInstance;
|
||||||
|
}));
|
||||||
|
it('should only show the grid component when the viewmode is set to grid', () => {
|
||||||
|
objectCollectionComponent.currentMode = ViewMode.Grid;
|
||||||
|
|
||||||
|
// expect(By.css('ds-object-grid')).toEqual(1);
|
||||||
|
// expect(By.css('ds-object-list')).toEqual(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should only show the list component when the viewmode is set to list', () => {
|
||||||
|
objectCollectionComponent.currentMode = ViewMode.List;
|
||||||
|
|
||||||
|
// expect(By.css('ds-object-list').length).toEqual(1);
|
||||||
|
// expect(By.css('ds-object-grid').length).toEqual(0);
|
||||||
|
})
|
||||||
|
|
||||||
|
});
|
@@ -0,0 +1,16 @@
|
|||||||
|
import { ViewMode } from '../../+search-page/search-options.model';
|
||||||
|
import { renderElementsFor } from './dso-element-decorator';
|
||||||
|
import { Item } from '../../core/shared/item.model';
|
||||||
|
|
||||||
|
describe('ElementDecorator', () => {
|
||||||
|
let gridDecorator = renderElementsFor(Item, ViewMode.Grid);
|
||||||
|
let listDecorator = renderElementsFor(Item, ViewMode.List);
|
||||||
|
it('should have a decorator for both list and grid', () => {
|
||||||
|
expect(listDecorator.length).not.toBeNull();
|
||||||
|
expect(gridDecorator.length).not.toBeNull();
|
||||||
|
});
|
||||||
|
it('should have 2 separate decorators for grid and list', () => {
|
||||||
|
expect(listDecorator).not.toEqual(gridDecorator);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
@@ -2,24 +2,24 @@ import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
|||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { DebugElement } from '@angular/core';
|
import { DebugElement } from '@angular/core';
|
||||||
|
|
||||||
import { ThumbnailComponent } from './thumbnail.component';
|
import { GridThumbnailComponent } from './grid-thumbnail.component';
|
||||||
import { Bitstream } from '../../core/shared/bitstream.model';
|
import { Bitstream } from '../../core/shared/bitstream.model';
|
||||||
import { SafeUrlPipe } from '../../shared/utils/safe-url-pipe';
|
import { SafeUrlPipe } from '../../shared/utils/safe-url-pipe';
|
||||||
|
|
||||||
describe('ThumbnailComponent', () => {
|
describe('ThumbnailComponent', () => {
|
||||||
let comp: ThumbnailComponent;
|
let comp: GridThumbnailComponent;
|
||||||
let fixture: ComponentFixture<ThumbnailComponent>;
|
let fixture: ComponentFixture<GridThumbnailComponent>;
|
||||||
let de: DebugElement;
|
let de: DebugElement;
|
||||||
let el: HTMLElement;
|
let el: HTMLElement;
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
declarations: [ThumbnailComponent, SafeUrlPipe]
|
declarations: [GridThumbnailComponent, SafeUrlPipe]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fixture = TestBed.createComponent(ThumbnailComponent);
|
fixture = TestBed.createComponent(GridThumbnailComponent);
|
||||||
comp = fixture.componentInstance; // BannerComponent test instance
|
comp = fixture.componentInstance; // BannerComponent test instance
|
||||||
de = fixture.debugElement.query(By.css('div.thumbnail'));
|
de = fixture.debugElement.query(By.css('div.thumbnail'));
|
||||||
el = de.nativeElement;
|
el = de.nativeElement;
|
||||||
|
@@ -0,0 +1,6 @@
|
|||||||
|
import { ItemGridElementComponent } from './item-grid-element.component';
|
||||||
|
|
||||||
|
describe('ItemGridElementComponent',()=>{
|
||||||
|
let itemGridElementComponent: ItemGridElementComponent;
|
||||||
|
|
||||||
|
})
|
0
src/app/object-grid/object-grid.component.spec.ts
Normal file
0
src/app/object-grid/object-grid.component.spec.ts
Normal file
Reference in New Issue
Block a user