Skip to content

Commit

Permalink
fixes #590: change isCompoundSelector to not match prop selector
Browse files Browse the repository at this point in the history
  • Loading branch information
joeduncan committed Sep 12, 2016
1 parent 08f97a2 commit b050472
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export function selectorError(selector, type = '') {
);
}

export const isCompoundSelector = /([a-z]\.[a-z]|[a-z]\[.*\]|[a-z]#[a-z])/i;
export const isCompoundSelector = /^(\w+#\w+(\.\w+)*|\.?\w+(\.\w+)+|\w+\[.*\])$/i;

const isPropSelector = /^\[.*\]$/;

Expand Down
11 changes: 11 additions & 0 deletions test/ShallowWrapper-spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,17 @@ describe('shallow', () => {
expect(wrapper.find('.foo').type()).to.equal('input');
});

it('should find element that has dot in attribute', () => {
const wrapper = shallow(
<div>
<div data-baz="foo.bar" />
</div>
);

const elements = wrapper.find('[data-baz="foo.bar"]');
expect(elements.length).to.equal(1);
});

it('should find an element based on a tag name and class name', () => {
const wrapper = shallow(
<div>
Expand Down

0 comments on commit b050472

Please sign in to comment.