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

View File

@@ -57,14 +57,14 @@ describe('MetadataUriValuesComponent', () => {
}); });
it('should contain the correct hrefs', () => { 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) { for (const metadatum of mockMetadata) {
expect(containsHref(links, metadatum.value)).toBeTruthy(); expect(containsHref(links, metadatum.value)).toBeTruthy();
} }
}); });
it('should contain separators equal to the amount of metadata values minus one', () => { 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); expect(separators.length).toBe(mockMetadata.length - 1);
}); });
@@ -76,7 +76,7 @@ describe('MetadataUriValuesComponent', () => {
}); });
it('should replace the metadata value with the linktext', () => { 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); expect(link.nativeElement.textContent).toContain(mockLinkText);
}); });

View File

@@ -1,5 +1,5 @@
<ds-metadata-field-wrapper [label]="label | translate"> <ds-metadata-field-wrapper [label]="label | translate">
<span *ngFor="let metadatum of values; let last=last;"> <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> </span>
</ds-metadata-field-wrapper> </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', () => { 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); 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> <div *ngIf="searchResults?.hasSucceeded && !searchResults?.isLoading && searchResults?.payload?.page.length > 0" @fadeIn>
<ds-viewable-collection <ds-viewable-collection
[config]="searchConfig.pagination" [config]="searchConfig.pagination"

View File

@@ -24,7 +24,7 @@ describe('SearchResultsComponent', () => {
fixture = TestBed.createComponent(SearchResultsComponent); fixture = TestBed.createComponent(SearchResultsComponent);
comp = fixture.componentInstance; // SearchFormComponent test instance comp = fixture.componentInstance; // SearchFormComponent test instance
heading = fixture.debugElement.query(By.css('heading')); 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', () => { describe('when results are not empty', () => {