mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-15 22:13:02 +00:00
[TLC-380] Lint fixes
This commit is contained in:
@@ -55,7 +55,7 @@ export class BrowseLinkDataService extends IdentifiableDataService<BrowseDefinit
|
|||||||
let searchKeyArray: string[] = [];
|
let searchKeyArray: string[] = [];
|
||||||
metadataKeys.forEach((metadataKey) => {
|
metadataKeys.forEach((metadataKey) => {
|
||||||
searchKeyArray = searchKeyArray.concat(BrowseService.toSearchKeyArray(metadataKey));
|
searchKeyArray = searchKeyArray.concat(BrowseService.toSearchKeyArray(metadataKey));
|
||||||
})
|
});
|
||||||
return this.getBrowseLinks().pipe(
|
return this.getBrowseLinks().pipe(
|
||||||
getRemoteDataPayload(),
|
getRemoteDataPayload(),
|
||||||
getPaginatedListPayload(),
|
getPaginatedListPayload(),
|
||||||
|
@@ -229,7 +229,6 @@ export class BrowseService {
|
|||||||
* @param linkPath
|
* @param linkPath
|
||||||
*/
|
*/
|
||||||
getBrowseURLFor(metadataKey: string, linkPath: string): Observable<string> {
|
getBrowseURLFor(metadataKey: string, linkPath: string): Observable<string> {
|
||||||
console.log("Looking for " + metadataKey + " in link path " + linkPath);
|
|
||||||
const searchKeyArray = BrowseService.toSearchKeyArray(metadataKey);
|
const searchKeyArray = BrowseService.toSearchKeyArray(metadataKey);
|
||||||
return this.getBrowseDefinitions().pipe(
|
return this.getBrowseDefinitions().pipe(
|
||||||
getRemoteDataPayload(),
|
getRemoteDataPayload(),
|
||||||
@@ -261,7 +260,7 @@ export class BrowseService {
|
|||||||
let searchKeyArray: string[] = [];
|
let searchKeyArray: string[] = [];
|
||||||
metadataKeys.forEach((metadataKey) => {
|
metadataKeys.forEach((metadataKey) => {
|
||||||
searchKeyArray = searchKeyArray.concat(BrowseService.toSearchKeyArray(metadataKey));
|
searchKeyArray = searchKeyArray.concat(BrowseService.toSearchKeyArray(metadataKey));
|
||||||
})
|
});
|
||||||
return this.getBrowseDefinitions().pipe(
|
return this.getBrowseDefinitions().pipe(
|
||||||
getRemoteDataPayload(),
|
getRemoteDataPayload(),
|
||||||
getPaginatedListPayload(),
|
getPaginatedListPayload(),
|
||||||
|
@@ -71,7 +71,7 @@ export class MetadataValuesComponent implements OnChanges {
|
|||||||
*/
|
*/
|
||||||
hasLink(value): boolean {
|
hasLink(value): boolean {
|
||||||
if (hasValue(this.urlRegex)) {
|
if (hasValue(this.urlRegex)) {
|
||||||
const pattern: RegExp = new RegExp(this.urlRegex);
|
const pattern = new RegExp(this.urlRegex);
|
||||||
return pattern.test(value.value);
|
return pattern.test(value.value);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@@ -135,37 +135,37 @@ describe('ItemPageFieldComponent', () => {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("test rendering of configured browse links", () => {
|
describe('test rendering of configured browse links', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
it('should have a browse link', () => {
|
it('should have a browse link', () => {
|
||||||
expect(fixture.debugElement.query(By.css('a.ds-browse-link')).nativeElement.innerHTML).toContain(mockValue);
|
expect(fixture.debugElement.query(By.css('a.ds-browse-link')).nativeElement.innerHTML).toContain(mockValue);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("test rendering of configured regex-based links", () => {
|
describe('test rendering of configured regex-based links', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
comp.urlRegex = '^test'
|
comp.urlRegex = '^test';
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
it('should have a rendered (non-browse) link since the value matches ^test', () => {
|
it('should have a rendered (non-browse) link since the value matches ^test', () => {
|
||||||
expect(fixture.debugElement.query(By.css('a.ds-simple-metadata-link')).nativeElement.innerHTML).toContain(mockValue);
|
expect(fixture.debugElement.query(By.css('a.ds-simple-metadata-link')).nativeElement.innerHTML).toContain(mockValue);
|
||||||
})
|
});
|
||||||
}))
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("test skipping of configured links that do NOT match regex", () => {
|
describe('test skipping of configured links that do NOT match regex', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
comp.urlRegex = '^nope'
|
comp.urlRegex = '^nope';
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
it('should NOT have a rendered (non-browse) link since the value matches ^test', () => {
|
it('should NOT have a rendered (non-browse) link since the value matches ^test', () => {
|
||||||
expect(fixture.debugElement.query(By.css('a.ds-simple-metadata-link'))).toBeNull()
|
expect(fixture.debugElement.query(By.css('a.ds-simple-metadata-link'))).toBeNull();
|
||||||
})
|
});
|
||||||
}))
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -181,6 +181,6 @@ export function mockItemWithMetadataFieldsAndValue(fields: string[], value: stri
|
|||||||
language: 'en_US',
|
language: 'en_US',
|
||||||
value: value
|
value: value
|
||||||
}] as MetadataValue[];
|
}] as MetadataValue[];
|
||||||
})
|
});
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@ export class MetadataRepresentationListElementComponent {
|
|||||||
|
|
||||||
isLink(): boolean {
|
isLink(): boolean {
|
||||||
// Match any http:// or https://
|
// Match any http:// or https://
|
||||||
const linkPattern: RegExp = /^https?\/\//;
|
const linkPattern = /^https?\/\//;
|
||||||
return linkPattern.test(this.metadataRepresentation.getValue());
|
return linkPattern.test(this.metadataRepresentation.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -15,24 +15,24 @@ import { PageInfo } from '../../core/shared/page-info.model';
|
|||||||
// This data is in post-serialized form (metadata -> metadataKeys)
|
// This data is in post-serialized form (metadata -> metadataKeys)
|
||||||
export const mockData: BrowseDefinition[] = [
|
export const mockData: BrowseDefinition[] = [
|
||||||
Object.assign(new BrowseDefinition, {
|
Object.assign(new BrowseDefinition, {
|
||||||
"id" : "dateissued",
|
'id' : 'dateissued',
|
||||||
"metadataBrowse" : false,
|
'metadataBrowse' : false,
|
||||||
"dataType" : "date",
|
'dataType' : 'date',
|
||||||
"sortOptions" : EMPTY,
|
'sortOptions' : EMPTY,
|
||||||
"order" : "ASC",
|
'order' : 'ASC',
|
||||||
"type" : "browse",
|
'type' : 'browse',
|
||||||
"metadataKeys" : [ "dc.date.issued" ],
|
'metadataKeys' : [ 'dc.date.issued' ],
|
||||||
"_links" : EMPTY
|
'_links' : EMPTY
|
||||||
}),
|
}),
|
||||||
Object.assign(new BrowseDefinition, {
|
Object.assign(new BrowseDefinition, {
|
||||||
"id" : "author",
|
'id' : 'author',
|
||||||
"metadataBrowse" : true,
|
'metadataBrowse' : true,
|
||||||
"dataType" : "text",
|
'dataType' : 'text',
|
||||||
"sortOptions" : EMPTY,
|
'sortOptions' : EMPTY,
|
||||||
"order" : "ASC",
|
'order' : 'ASC',
|
||||||
"type" : "browse",
|
'type' : 'browse',
|
||||||
"metadataKeys" : [ "dc.contributor.*", "dc.creator" ],
|
'metadataKeys' : [ 'dc.contributor.*', 'dc.creator' ],
|
||||||
"_links" : EMPTY
|
'_links' : EMPTY
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ export const browseLinkDataServiceStub: any = {
|
|||||||
let searchKeyArray: string[] = [];
|
let searchKeyArray: string[] = [];
|
||||||
metadataKeys.forEach((metadataKey) => {
|
metadataKeys.forEach((metadataKey) => {
|
||||||
searchKeyArray = searchKeyArray.concat(BrowseService.toSearchKeyArray(metadataKey));
|
searchKeyArray = searchKeyArray.concat(BrowseService.toSearchKeyArray(metadataKey));
|
||||||
})
|
});
|
||||||
return this.getBrowseLinks().pipe(
|
return this.getBrowseLinks().pipe(
|
||||||
getRemoteDataPayload(),
|
getRemoteDataPayload(),
|
||||||
getPaginatedListPayload(),
|
getPaginatedListPayload(),
|
||||||
@@ -74,4 +74,4 @@ export const browseLinkDataServiceStub: any = {
|
|||||||
distinctUntilChanged()
|
distinctUntilChanged()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
Reference in New Issue
Block a user