Skip to content
This repository was archived by the owner on Oct 12, 2021. It is now read-only.

fix(AppShell): make CSS class selectors case insensitive #65

Merged
merged 1 commit into from
Jun 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ describe('CssNodeMatcher', () => {
expect(complexSelector.match(node)).toBe(true);
});

it('should match case insensitive class selector', () => {
const classSelector = CssSelector.parse('.DIALOG');
const selector = new CssNodeMatcher(classSelector);
expect(selector.match(node)).toBe(true);
const complexClassSelector = CssSelector.parse('.dialog.modal--drop');
const complexSelector = new CssNodeMatcher(complexClassSelector);
expect(complexSelector.match(node)).toBe(true);
});

it('should match element by id', () => {
const idSelector = CssSelector.parse('#dialog-id');
const selector = new CssNodeMatcher(idSelector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export class CssNodeMatcher extends NodeMatcher {
if (!classAttr) {
return false;
}
const classMap = classAttr.value.split(' ')
const classMap = classAttr.value
.toLowerCase().split(' ')
.reduce((accum: any, val: string) => {
accum[val] = true;
return accum;
Expand Down
2 changes: 0 additions & 2 deletions app-shell/src/app/shell-parser/shell-parser.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
beforeEach,
it,
xit,
describe,
expect,
inject
Expand Down Expand Up @@ -131,7 +130,6 @@ describe('ShellParserImpl', () => {
describe('parseDoc', () => {

it('should strip with default selector', (done: any) => {
debugger;
const mockScope = new MockWorkerScope();
const parser = createMockedWorker(mockScope);
const response = new MockResponse(prerenderedTemplate);
Expand Down