mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-16 06:23:03 +00:00
[TLC-380] Lint fixes
This commit is contained in:
@@ -55,7 +55,7 @@ export class BrowseLinkDataService extends IdentifiableDataService<BrowseDefinit
|
||||
let searchKeyArray: string[] = [];
|
||||
metadataKeys.forEach((metadataKey) => {
|
||||
searchKeyArray = searchKeyArray.concat(BrowseService.toSearchKeyArray(metadataKey));
|
||||
})
|
||||
});
|
||||
return this.getBrowseLinks().pipe(
|
||||
getRemoteDataPayload(),
|
||||
getPaginatedListPayload(),
|
||||
|
@@ -229,7 +229,6 @@ export class BrowseService {
|
||||
* @param linkPath
|
||||
*/
|
||||
getBrowseURLFor(metadataKey: string, linkPath: string): Observable<string> {
|
||||
console.log("Looking for " + metadataKey + " in link path " + linkPath);
|
||||
const searchKeyArray = BrowseService.toSearchKeyArray(metadataKey);
|
||||
return this.getBrowseDefinitions().pipe(
|
||||
getRemoteDataPayload(),
|
||||
@@ -261,7 +260,7 @@ export class BrowseService {
|
||||
let searchKeyArray: string[] = [];
|
||||
metadataKeys.forEach((metadataKey) => {
|
||||
searchKeyArray = searchKeyArray.concat(BrowseService.toSearchKeyArray(metadataKey));
|
||||
})
|
||||
});
|
||||
return this.getBrowseDefinitions().pipe(
|
||||
getRemoteDataPayload(),
|
||||
getPaginatedListPayload(),
|
||||
|
@@ -71,7 +71,7 @@ export class MetadataValuesComponent implements OnChanges {
|
||||
*/
|
||||
hasLink(value): boolean {
|
||||
if (hasValue(this.urlRegex)) {
|
||||
const pattern: RegExp = new RegExp(this.urlRegex);
|
||||
const pattern = new RegExp(this.urlRegex);
|
||||
return pattern.test(value.value);
|
||||
}
|
||||
return false;
|
||||
|
@@ -135,37 +135,37 @@ describe('ItemPageFieldComponent', () => {
|
||||
|
||||
});
|
||||
|
||||
describe("test rendering of configured browse links", () => {
|
||||
describe('test rendering of configured browse links', () => {
|
||||
beforeEach(() => {
|
||||
fixture.detectChanges();
|
||||
});
|
||||
it('should have a browse link', () => {
|
||||
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(() => {
|
||||
comp.urlRegex = '^test'
|
||||
comp.urlRegex = '^test';
|
||||
fixture.detectChanges();
|
||||
});
|
||||
beforeEach(waitForAsync(() => {
|
||||
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);
|
||||
})
|
||||
}))
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
describe("test skipping of configured links that do NOT match regex", () => {
|
||||
describe('test skipping of configured links that do NOT match regex', () => {
|
||||
beforeEach(() => {
|
||||
comp.urlRegex = '^nope'
|
||||
comp.urlRegex = '^nope';
|
||||
fixture.detectChanges();
|
||||
});
|
||||
beforeEach(waitForAsync(() => {
|
||||
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',
|
||||
value: value
|
||||
}] as MetadataValue[];
|
||||
})
|
||||
});
|
||||
return item;
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@ export class MetadataRepresentationListElementComponent {
|
||||
|
||||
isLink(): boolean {
|
||||
// Match any http:// or https://
|
||||
const linkPattern: RegExp = /^https?\/\//;
|
||||
const linkPattern = /^https?\/\//;
|
||||
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)
|
||||
export const mockData: BrowseDefinition[] = [
|
||||
Object.assign(new BrowseDefinition, {
|
||||
"id" : "dateissued",
|
||||
"metadataBrowse" : false,
|
||||
"dataType" : "date",
|
||||
"sortOptions" : EMPTY,
|
||||
"order" : "ASC",
|
||||
"type" : "browse",
|
||||
"metadataKeys" : [ "dc.date.issued" ],
|
||||
"_links" : EMPTY
|
||||
'id' : 'dateissued',
|
||||
'metadataBrowse' : false,
|
||||
'dataType' : 'date',
|
||||
'sortOptions' : EMPTY,
|
||||
'order' : 'ASC',
|
||||
'type' : 'browse',
|
||||
'metadataKeys' : [ 'dc.date.issued' ],
|
||||
'_links' : EMPTY
|
||||
}),
|
||||
Object.assign(new BrowseDefinition, {
|
||||
"id" : "author",
|
||||
"metadataBrowse" : true,
|
||||
"dataType" : "text",
|
||||
"sortOptions" : EMPTY,
|
||||
"order" : "ASC",
|
||||
"type" : "browse",
|
||||
"metadataKeys" : [ "dc.contributor.*", "dc.creator" ],
|
||||
"_links" : EMPTY
|
||||
'id' : 'author',
|
||||
'metadataBrowse' : true,
|
||||
'dataType' : 'text',
|
||||
'sortOptions' : EMPTY,
|
||||
'order' : 'ASC',
|
||||
'type' : 'browse',
|
||||
'metadataKeys' : [ 'dc.contributor.*', 'dc.creator' ],
|
||||
'_links' : EMPTY
|
||||
})
|
||||
];
|
||||
|
||||
@@ -53,7 +53,7 @@ export const browseLinkDataServiceStub: any = {
|
||||
let searchKeyArray: string[] = [];
|
||||
metadataKeys.forEach((metadataKey) => {
|
||||
searchKeyArray = searchKeyArray.concat(BrowseService.toSearchKeyArray(metadataKey));
|
||||
})
|
||||
});
|
||||
return this.getBrowseLinks().pipe(
|
||||
getRemoteDataPayload(),
|
||||
getPaginatedListPayload(),
|
||||
@@ -74,4 +74,4 @@ export const browseLinkDataServiceStub: any = {
|
||||
distinctUntilChanged()
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user