Skip to content

Commit

Permalink
fix(layer-list): wrong keyword was used. (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
pelord authored and mbarbeau committed Dec 27, 2018
1 parent 6bf6bd6 commit 12785d4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions projects/geo/src/lib/layer/layer-list/layer-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,13 @@ export class LayerListComponent implements AfterViewInit {
localLayerKeywords.push(kw.normalize('NFD').replace(/[\u0300-\u036f]/g, ''));
});
}
if (this.keyword) {
const localKeyword = this.keyword.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
if (this.layerListService.getKeyword()) {
const localKeyword = this.layerListService.getKeyword().normalize('NFD').replace(/[\u0300-\u036f]/g, '');
const localLayerTitle = layer.title.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
if (
!new RegExp(localKeyword, 'gi').test(localLayerTitle) &&
!(this.keyword.toLowerCase() === layer.dataSource.options.type.toString().toLowerCase()) &&
!(this.layerListService.getKeyword()
.toLowerCase() === layer.dataSource.options.type.toString().toLowerCase()) &&
localLayerKeywords.filter(kw => new RegExp(localKeyword, 'gi').test(kw)).length === 0) {
const index = layerIDToKeep.indexOf(layer.id);
if (index > -1) {
Expand Down

0 comments on commit 12785d4

Please sign in to comment.