56434: By.css call by tag instead of class refactoring

This commit is contained in:
Kristof De Langhe
2018-10-26 13:57:36 +02:00
parent e39879b762
commit 1126af6b43
6 changed files with 9 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
<ds-metadata-field-wrapper [label]="label | translate">
<a *ngFor="let metadatum of values; let last=last;" [href]="metadatum.value" class="metadata-value-links">
{{ linktext || metadatum.value }}<span *ngIf="!last" class="metadata-value-separator" [innerHTML]="separator"></span>
<a *ngFor="let metadatum of values; let last=last;" [href]="metadatum.value">
{{ linktext || metadatum.value }}<span *ngIf="!last" [innerHTML]="separator"></span>
</a>
</ds-metadata-field-wrapper>

View File

@@ -57,14 +57,14 @@ describe('MetadataUriValuesComponent', () => {
});
it('should contain the correct hrefs', () => {
const links = fixture.debugElement.queryAll(By.css('.metadata-value-links'));
const links = fixture.debugElement.queryAll(By.css('a'));
for (const metadatum of mockMetadata) {
expect(containsHref(links, metadatum.value)).toBeTruthy();
}
});
it('should contain separators equal to the amount of metadata values minus one', () => {
const separators = fixture.debugElement.queryAll(By.css('.metadata-value-separator'));
const separators = fixture.debugElement.queryAll(By.css('a span'));
expect(separators.length).toBe(mockMetadata.length - 1);
});
@@ -76,7 +76,7 @@ describe('MetadataUriValuesComponent', () => {
});
it('should replace the metadata value with the linktext', () => {
const link = fixture.debugElement.query(By.css('.metadata-value-links'));
const link = fixture.debugElement.query(By.css('a'));
expect(link.nativeElement.textContent).toContain(mockLinkText);
});

View File

@@ -1,5 +1,5 @@
<ds-metadata-field-wrapper [label]="label | translate">
<span *ngFor="let metadatum of values; let last=last;">
{{metadatum.value}}<span *ngIf="!last" class="metadata-value-separator" [innerHTML]="separator"></span>
{{metadatum.value}}<span *ngIf="!last" [innerHTML]="separator"></span>
</span>
</ds-metadata-field-wrapper>

View File

@@ -60,7 +60,7 @@ describe('MetadataValuesComponent', () => {
});
it('should contain separators equal to the amount of metadata values minus one', () => {
const separators = fixture.debugElement.queryAll(By.css('.metadata-value-separator'));
const separators = fixture.debugElement.queryAll(By.css('span>span'));
expect(separators.length).toBe(mockMetadata.length - 1);
});

View File

@@ -1,4 +1,4 @@
<h2 *ngIf="!disableHeader" class="search-results-title">{{ getTitleKey() | translate }}</h2>
<h2 *ngIf="!disableHeader">{{ getTitleKey() | translate }}</h2>
<div *ngIf="searchResults?.hasSucceeded && !searchResults?.isLoading && searchResults?.payload?.page.length > 0" @fadeIn>
<ds-viewable-collection
[config]="searchConfig.pagination"

View File

@@ -24,7 +24,7 @@ describe('SearchResultsComponent', () => {
fixture = TestBed.createComponent(SearchResultsComponent);
comp = fixture.componentInstance; // SearchFormComponent test instance
heading = fixture.debugElement.query(By.css('heading'));
title = fixture.debugElement.query(By.css('.search-results-title'));
title = fixture.debugElement.query(By.css('h2'));
});
describe('when results are not empty', () => {