Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ themes:

# The default bundles that should always be displayed as suggestions when you upload a new bundle
bundle:
standardBundles: [ ORIGINAL, THUMBNAIL, LICENSE ]
standardBundles: [ ORIGINAL, THUMBNAIL, LICENSE, CC-LICENSE ]

# Whether to enable media viewer for image and/or video Bitstreams (i.e. Bitstreams whose MIME type starts with 'image' or 'video').
# For images, this enables a gallery viewer where you can zoom or page through images.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule } from '@ngx-translate/core';
import { of as observableOf } from 'rxjs';

import { DefaultAppConfig } from '../../../../config/default-app-config';
import { environment } from '../../../../environments/environment';
import { AuthService } from '../../../core/auth/auth.service';
import { BundleDataService } from '../../../core/data/bundle-data.service';
Expand Down Expand Up @@ -281,6 +282,48 @@ describe('UploadBitstreamComponent', () => {
});
});

describe('when the shipped default bundle configuration is used', () => {
const shippedStandardBundles = new DefaultAppConfig().bundle.standardBundles;
let originalStandardBundles: string[];

beforeEach(() => {
originalStandardBundles = environment.bundle.standardBundles;
environment.bundle.standardBundles = shippedStandardBundles;
});

afterEach(() => {
environment.bundle.standardBundles = originalStandardBundles;
});

describe('and the item has no bundles yet', () => {
beforeEach(waitForAsync(() => {
createUploadBitstreamTestingModule({});
jasmine.getEnv().allowRespy(true);
mockItemDataService.getBundles.and.returnValue(createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo(), [])));
loadFixtureAndComp();
}));

it('should offer CC-LICENSE as a bundle to upload a bitstream to', () => {
// noinspection JSDeprecatedSymbols
expect(comp.bundles.map((suggestion: Bundle) => suggestion.name)).toContain('CC-LICENSE');
});
});

describe('and the item already has other bundles', () => {
beforeEach(waitForAsync(() => {
createUploadBitstreamTestingModule({});
jasmine.getEnv().allowRespy(true);
mockItemDataService.getBundles.and.returnValue(createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo(), [bundle])));
loadFixtureAndComp();
}));

it('should offer CC-LICENSE as a bundle to upload a bitstream to', () => {
// noinspection JSDeprecatedSymbols
expect(comp.bundles.map((suggestion: Bundle) => suggestion.name)).toContain('CC-LICENSE');
});
});
});

/**
* Setup an UploadBitstreamComponent testing module with custom queryParams for the route
* @param queryParams
Expand Down
21 changes: 21 additions & 0 deletions src/config/default-app-config.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { DefaultAppConfig } from './default-app-config';

describe('DefaultAppConfig', () => {
describe('bundle.standardBundles', () => {
let standardBundles: string[];

beforeEach(() => {
standardBundles = new DefaultAppConfig().bundle.standardBundles;
});

it('should keep offering the out-of-the-box DSpace bundles', () => {
expect(standardBundles).toContain('ORIGINAL');
expect(standardBundles).toContain('THUMBNAIL');
expect(standardBundles).toContain('LICENSE');
});

it('should offer CC-LICENSE, so a Creative Commons licence can be added to an item', () => {
expect(standardBundles).toContain('CC-LICENSE');
});
});
});
2 changes: 1 addition & 1 deletion src/config/default-app-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ export class DefaultAppConfig implements AppConfig {
// The default bundles that should always be displayed when you edit or add a bundle even when no bundle has been
// added to the item yet.
bundle: BundleConfig = {
standardBundles: ['ORIGINAL', 'THUMBNAIL', 'LICENSE'],
standardBundles: ['ORIGINAL', 'THUMBNAIL', 'LICENSE', 'CC-LICENSE'],
};
// Whether to enable media viewer for image and/or video Bitstreams (i.e. Bitstreams whose MIME type starts with "image" or "video").
// For images, this enables a gallery viewer where you can zoom or page through images.
Expand Down
Loading