Skip to content

Commit

Permalink
refactor: unused util
Browse files Browse the repository at this point in the history
  • Loading branch information
mcataford committed Mar 1, 2020
1 parent a26f4a2 commit 67f9749
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
11 changes: 0 additions & 11 deletions src/components/__tests__/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,6 @@ describe('utils', () => {
).toEqual({});
});

it('hasClass', () => {
const DEFAULT_HTML = `<html><body>
<div class="abc cde">test</div>
</body></html>`;
const doc = jsdom.jsdom(DEFAULT_HTML);
const element = doc.querySelector('.abc');

expect(utils.hasClass(element, 'cde')).toBeTruthy();
});


it('findIndex', () => {
let array = [];
let predicate = () => true;
Expand Down
11 changes: 1 addition & 10 deletions src/components/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,7 @@ export default {

return {};
},

// Copied from http://jaketrent.com/post/addremove-classes-raw-javascript/
hasClass(el, className) {
if (el.classList) {
return el.classList.contains(className);
}

return !!el.className.match(new RegExp(`(\\s|^)${className}(\\s|$)`));
},


findIndex(items, predicate) {
let index = -1;

Expand Down

0 comments on commit 67f9749

Please sign in to comment.