Skip to content

Commit

Permalink
Merge pull request #297 from Availity/fix/upload
Browse files Browse the repository at this point in the history
change includes method to indexOf
  • Loading branch information
robmcguinness committed Jan 30, 2018
2 parents 0bed02f + cac7c39 commit 91e530b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/ui/dropdown/directive.js
Expand Up @@ -10,7 +10,7 @@ if (!jQuery.avPatchedTouchEvents) {

jQuery.event.special.touchstart = {
setup(_, ns, handle) {
if (ns.includes('noPreventDefault') ) {
if (ns.indexOf('noPreventDefault') >= 0 ) {
this.addEventListener('touchstart', handle, { passive: false });
} else {
this.addEventListener('touchstart', handle, { passive: true });
Expand All @@ -20,7 +20,7 @@ if (!jQuery.avPatchedTouchEvents) {

jQuery.event.special.touchend = {
setup(_, ns, handle) {
if (ns.includes('noPreventDefault') ) {
if (ns.indexOf('noPreventDefault') >= 0 ) {
this.addEventListener('touchend', handle, { passive: false });
} else {
this.addEventListener('touchend', handle, { passive: true });
Expand All @@ -30,7 +30,7 @@ if (!jQuery.avPatchedTouchEvents) {

jQuery.event.special.touchmove = {
setup(_, ns, handle) {
if (ns.includes('noPreventDefault') ) {
if (ns.indexOf('noPreventDefault') >= 0 ) {
this.addEventListener('touchmove', handle, { passive: false });
} else {
this.addEventListener('touchmove', handle, { passive: true });
Expand Down
13 changes: 10 additions & 3 deletions src/ui/uploads/tests/upload-progress-bar-spec.js
Expand Up @@ -17,17 +17,21 @@ describe('uploadProgessBar', () => {
it('should render with defaults', () => {
tester.$scope.upload = {
percentage: 0,
onProgress: []
onProgress: [],
onSuccess: [],
onError: []
};
const el = tester.compileDirective(template, null, null);
const progressBar = el.find('.progress');
expect(progressBar.hasClass('progress')).toBeTruthy();
});

it('should render with 50% progess', () => {
it('should render with 50% progress', () => {
tester.$scope.upload = {
percentage: 50,
onProgress: [],
onSuccess: [],
onError: [],
completed: false
};
const el = tester.compileDirective(template, null, null);
Expand All @@ -37,14 +41,17 @@ describe('uploadProgessBar', () => {
expect(progressBar.attr('style')).toBe('width: 50%;');
});

it('should render with with 100% progress', () => {
it('should render with 100% progress', () => {
tester.$scope.upload = {
percentage: 100,
onProgress: [],
onSuccess: [],
onError: [],
completed: false
};
const el = tester.compileDirective(template, null, null);
tester.$scope.upload.onProgress.forEach(cb => cb(50, 100));
tester.$scope.upload.onSuccess.forEach(cb => cb(50, 100));
tester.$scope.$apply();
const progress = el.find('.progress');
const progressBar = el.find('.progress-bar');
Expand Down

0 comments on commit 91e530b

Please sign in to comment.