Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #643 from atmire/Edit-Collection---Assign-Roles-Gr…
…oups Edit collection - assign roles groups
- Loading branch information
Showing
12 changed files
with
511 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<ds-comcol-role | ||
*ngFor="let comcolRole of getComcolRoles() | async" | ||
[dso]="collection$ | async" | ||
[comcolRole]="comcolRole" | ||
> | ||
</ds-comcol-role> |
121 changes: 121 additions & 0 deletions
121
...+collection-page/edit-collection-page/collection-roles/collection-roles.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
import { ComponentFixture, TestBed} from '@angular/core/testing'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { ActivatedRoute } from '@angular/router'; | ||
import { of as observableOf } from 'rxjs/internal/observable/of'; | ||
import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; | ||
import { By } from '@angular/platform-browser'; | ||
import { RemoteData } from '../../../core/data/remote-data'; | ||
import { CollectionRolesComponent } from './collection-roles.component'; | ||
import { Collection } from '../../../core/shared/collection.model'; | ||
import { SharedModule } from '../../../shared/shared.module'; | ||
import { GroupDataService } from '../../../core/eperson/group-data.service'; | ||
import { RequestService } from '../../../core/data/request.service'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
|
||
describe('CollectionRolesComponent', () => { | ||
|
||
let fixture: ComponentFixture<CollectionRolesComponent>; | ||
let comp: CollectionRolesComponent; | ||
let de: DebugElement; | ||
|
||
beforeEach(() => { | ||
|
||
const route = { | ||
parent: { | ||
data: observableOf({ | ||
dso: new RemoteData( | ||
false, | ||
false, | ||
true, | ||
undefined, | ||
Object.assign(new Collection(), { | ||
_links: { | ||
'irrelevant': { | ||
href: 'irrelevant link', | ||
}, | ||
'adminGroup': { | ||
href: 'adminGroup link', | ||
}, | ||
'submittersGroup': { | ||
href: 'submittersGroup link', | ||
}, | ||
'itemReadGroup': { | ||
href: 'itemReadGroup link', | ||
}, | ||
'bitstreamReadGroup': { | ||
href: 'bitstreamReadGroup link', | ||
}, | ||
'workflowGroups/test': { | ||
href: 'test workflow group link', | ||
}, | ||
}, | ||
}), | ||
), | ||
}) | ||
} | ||
}; | ||
|
||
const requestService = { | ||
hasByHrefObservable: () => observableOf(true), | ||
}; | ||
|
||
const groupDataService = { | ||
findByHref: () => observableOf(new RemoteData( | ||
false, | ||
false, | ||
true, | ||
undefined, | ||
{}, | ||
200, | ||
)), | ||
}; | ||
|
||
TestBed.configureTestingModule({ | ||
imports: [ | ||
SharedModule, | ||
RouterTestingModule.withRoutes([]), | ||
TranslateModule.forRoot(), | ||
], | ||
declarations: [ | ||
CollectionRolesComponent, | ||
], | ||
providers: [ | ||
{ provide: ActivatedRoute, useValue: route }, | ||
{ provide: RequestService, useValue: requestService }, | ||
{ provide: GroupDataService, useValue: groupDataService }, | ||
], | ||
schemas: [NO_ERRORS_SCHEMA] | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(CollectionRolesComponent); | ||
comp = fixture.componentInstance; | ||
de = fixture.debugElement; | ||
|
||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should display a collection admin role component', () => { | ||
expect(de.query(By.css('ds-comcol-role .collection-admin'))) | ||
.toBeTruthy(); | ||
}); | ||
|
||
it('should display a submitters role component', () => { | ||
expect(de.query(By.css('ds-comcol-role .submitters'))) | ||
.toBeTruthy(); | ||
}); | ||
|
||
it('should display a default item read role component', () => { | ||
expect(de.query(By.css('ds-comcol-role .item_read'))) | ||
.toBeTruthy(); | ||
}); | ||
|
||
it('should display a default bitstream read role component', () => { | ||
expect(de.query(By.css('ds-comcol-role .bitstream_read'))) | ||
.toBeTruthy(); | ||
}); | ||
|
||
it('should display a test workflow role component', () => { | ||
expect(de.query(By.css('ds-comcol-role .test'))) | ||
.toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.