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

Fix jshint warnings in tests (mostly semicolons) #1082

Merged
merged 1 commit into from
Jul 28, 2015
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
4 changes: 2 additions & 2 deletions test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ beforeEach(function() {
return {
pass: pass,
message: "Expected '" + actual + "'" + (pass ? ' not ' : ' ') + "to have class '" + cls + "'."
}
};
}
}
};
}
});
});
90 changes: 45 additions & 45 deletions test/select.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('ui-select tests', function() {
link: function (scope, element, attrs, ctrl) {

}
}
};

});

Expand Down Expand Up @@ -111,8 +111,8 @@ describe('ui-select tests', function() {
if (attrs.tagging !== undefined) { attrsHtml += ' tagging="' + attrs.tagging + '"'; }
if (attrs.taggingTokens !== undefined) { attrsHtml += ' tagging-tokens="' + attrs.taggingTokens + '"'; }
if (attrs.title !== undefined) { attrsHtml += ' title="' + attrs.title + '"'; }
if (attrs.appendToBody != undefined) { attrsHtml += ' append-to-body="' + attrs.appendToBody + '"'; }
if (attrs.allowClear != undefined) { matchAttrsHtml += ' allow-clear="' + attrs.allowClear + '"';}
if (attrs.appendToBody !== undefined) { attrsHtml += ' append-to-body="' + attrs.appendToBody + '"'; }
if (attrs.allowClear !== undefined) { matchAttrsHtml += ' allow-clear="' + attrs.allowClear + '"';}
}

return compileTemplate(
Expand Down Expand Up @@ -180,7 +180,7 @@ describe('ui-select tests', function() {
var $select = el.scope().$select;
$select.open = true;
scope.$digest();
};
}

function closeDropdown(el) {
var $select = el.scope().$select;
Expand Down Expand Up @@ -986,7 +986,7 @@ describe('ui-select tests', function() {
scope.$digest();

expect(highlighted).toBe(scope.people[5]);
})
});

it('should set $item & $model correctly when invoking callback on select and no single prop. binding', function () {

Expand Down Expand Up @@ -1223,7 +1223,7 @@ describe('ui-select tests', function() {

});

it('should format view value correctly when using single property binding and refresh funcion', function () {
it('should format view value correctly when using single property binding and refresh function', function () {

var el = compileTemplate(
'<ui-select ng-model="selection.selected"> \
Expand All @@ -1241,19 +1241,19 @@ describe('ui-select tests', function() {
scope.fetchFromServer = function(searching){

if (searching == 's')
return scope.people
return scope.people;

if (searching == 'o'){
scope.people = []; //To simulate cases were previously selected item isnt in the list anymore
}

};

setSearchText(el, 'r')
setSearchText(el, 'r');
clickItem(el, 'Samantha');
expect(getMatchLabel(el)).toBe('Samantha');

setSearchText(el, 'o')
setSearchText(el, 'o');
expect(getMatchLabel(el)).toBe('Samantha');

});
Expand Down Expand Up @@ -1428,7 +1428,7 @@ describe('ui-select tests', function() {

});

it('should remove hightlighted match when pressing BACKSPACE key from search and decrease activeMatchIndex', function() {
it('should remove highlighted match when pressing BACKSPACE key from search and decrease activeMatchIndex', function() {

scope.selection.selectedMultiple = [scope.people[4], scope.people[5], scope.people[6]]; //Wladimir, Samantha & Nicole
var el = createUiSelectMultiple();
Expand All @@ -1444,7 +1444,7 @@ describe('ui-select tests', function() {

});

it('should remove hightlighted match when pressing DELETE key from search and keep same activeMatchIndex', function() {
it('should remove highlighted match when pressing DELETE key from search and keep same activeMatchIndex', function() {

scope.selection.selectedMultiple = [scope.people[4], scope.people[5], scope.people[6]]; //Wladimir, Samantha & Nicole
var el = createUiSelectMultiple();
Expand Down Expand Up @@ -1479,13 +1479,13 @@ describe('ui-select tests', function() {
var searchInput = el.find('.ui-select-search');

expect(isDropdownOpened(el)).toEqual(false);
triggerKeydown(searchInput, Key.Left)
triggerKeydown(searchInput, Key.Left)
triggerKeydown(searchInput, Key.Left);
triggerKeydown(searchInput, Key.Left);
expect(isDropdownOpened(el)).toEqual(false);
expect(el.scope().$selectMultiple.activeMatchIndex).toBe(el.scope().$select.selected.length - 2);
triggerKeydown(searchInput, Key.Left)
triggerKeydown(searchInput, Key.Left)
triggerKeydown(searchInput, Key.Left)
triggerKeydown(searchInput, Key.Left);
triggerKeydown(searchInput, Key.Left);
triggerKeydown(searchInput, Key.Left);
expect(el.scope().$selectMultiple.activeMatchIndex).toBe(0);

});
Expand All @@ -1496,9 +1496,9 @@ describe('ui-select tests', function() {
var el = createUiSelectMultiple();
var searchInput = el.find('.ui-select-search');

el.scope().$selectMultiple.activeMatchIndex = 3
triggerKeydown(searchInput, Key.Left)
triggerKeydown(searchInput, Key.Left)
el.scope().$selectMultiple.activeMatchIndex = 3;
triggerKeydown(searchInput, Key.Left);
triggerKeydown(searchInput, Key.Left);
expect(el.scope().$selectMultiple.activeMatchIndex).toBe(1);

});
Expand All @@ -1509,9 +1509,9 @@ describe('ui-select tests', function() {
var el = createUiSelectMultiple();
var searchInput = el.find('.ui-select-search');

el.scope().$selectMultiple.activeMatchIndex = 0
triggerKeydown(searchInput, Key.Right)
triggerKeydown(searchInput, Key.Right)
el.scope().$selectMultiple.activeMatchIndex = 0;
triggerKeydown(searchInput, Key.Right);
triggerKeydown(searchInput, Key.Right);
expect(el.scope().$selectMultiple.activeMatchIndex).toBe(2);

});
Expand All @@ -1523,7 +1523,7 @@ describe('ui-select tests', function() {
var searchInput = el.find('.ui-select-search');

expect(isDropdownOpened(el)).toEqual(false);
triggerKeydown(searchInput, Key.Down)
triggerKeydown(searchInput, Key.Down);
expect(isDropdownOpened(el)).toEqual(true);

});
Expand Down Expand Up @@ -1558,7 +1558,7 @@ describe('ui-select tests', function() {
var searchInput = el.find('.ui-select-search');

expect(isDropdownOpened(el)).toEqual(false);
triggerKeydown(searchInput, Key.Down)
triggerKeydown(searchInput, Key.Down);
expect(isDropdownOpened(el)).toEqual(true);

clickItem(el, 'Wladimir');
Expand All @@ -1574,7 +1574,7 @@ describe('ui-select tests', function() {
var searchInput = el.find('.ui-select-search');

expect(isDropdownOpened(el)).toEqual(false);
triggerKeydown(searchInput, Key.Down)
triggerKeydown(searchInput, Key.Down);
expect(isDropdownOpened(el)).toEqual(true);

clickItem(el, 'Wladimir');
Expand All @@ -1590,9 +1590,9 @@ describe('ui-select tests', function() {
var searchInput = el.find('.ui-select-search');

expect(isDropdownOpened(el)).toEqual(false);
triggerKeydown(searchInput, Key.Down)
triggerKeydown(searchInput, Key.Down);
expect(isDropdownOpened(el)).toEqual(true);
triggerKeydown(searchInput, Key.Escape)
triggerKeydown(searchInput, Key.Escape);
expect(isDropdownOpened(el)).toEqual(false);

});
Expand All @@ -1603,8 +1603,8 @@ describe('ui-select tests', function() {
var el = createUiSelectMultiple();
var searchInput = el.find('.ui-select-search');

triggerKeydown(searchInput, Key.Down)
triggerKeydown(searchInput, Key.Enter)
triggerKeydown(searchInput, Key.Down);
triggerKeydown(searchInput, Key.Enter);
expect(scope.selection.selectedMultiple.length).toEqual(2);

});
Expand All @@ -1616,8 +1616,8 @@ describe('ui-select tests', function() {
spyOn(jQuery.Event.prototype, 'preventDefault');
spyOn(jQuery.Event.prototype, 'stopPropagation');

triggerKeydown(searchInput, Key.Down)
triggerKeydown(searchInput, Key.Enter)
triggerKeydown(searchInput, Key.Down);
triggerKeydown(searchInput, Key.Enter);
expect(jQuery.Event.prototype.preventDefault).toHaveBeenCalled();
expect(jQuery.Event.prototype.stopPropagation).toHaveBeenCalled();

Expand All @@ -1630,8 +1630,8 @@ describe('ui-select tests', function() {
spyOn(jQuery.Event.prototype, 'preventDefault');
spyOn(jQuery.Event.prototype, 'stopPropagation');

triggerKeydown(searchInput, Key.Down)
triggerKeydown(searchInput, Key.Escape)
triggerKeydown(searchInput, Key.Down);
triggerKeydown(searchInput, Key.Escape);
expect(jQuery.Event.prototype.preventDefault).toHaveBeenCalled();
expect(jQuery.Event.prototype.stopPropagation).toHaveBeenCalled();

Expand All @@ -1644,9 +1644,9 @@ describe('ui-select tests', function() {

triggerKeydown(searchInput, Key.Down); //Open dropdown

el.scope().$select.activeIndex = 0
triggerKeydown(searchInput, Key.Down)
triggerKeydown(searchInput, Key.Down)
el.scope().$select.activeIndex = 0;
triggerKeydown(searchInput, Key.Down);
triggerKeydown(searchInput, Key.Down);
expect(el.scope().$select.activeIndex).toBe(2);

});
Expand All @@ -1658,9 +1658,9 @@ describe('ui-select tests', function() {

triggerKeydown(searchInput, Key.Down); //Open dropdown

el.scope().$select.activeIndex = 5
triggerKeydown(searchInput, Key.Up)
triggerKeydown(searchInput, Key.Up)
el.scope().$select.activeIndex = 5;
triggerKeydown(searchInput, Key.Up);
triggerKeydown(searchInput, Key.Up);
expect(el.scope().$select.activeIndex).toBe(3);

});
Expand Down Expand Up @@ -1713,7 +1713,7 @@ describe('ui-select tests', function() {

});

it('should format view value correctly when using single property binding and refresh funcion', function () {
it('should format view value correctly when using single property binding and refresh function', function () {

scope.selection.selectedMultiple = ['[email protected]', '[email protected]'];

Expand All @@ -1733,21 +1733,21 @@ describe('ui-select tests', function() {
scope.fetchFromServer = function(searching){

if (searching == 'n')
return scope.people
return scope.people;

if (searching == 'o'){
scope.people = []; //To simulate cases were previously selected item isnt in the list anymore
}

};

setSearchText(el, 'n')
setSearchText(el, 'n');
clickItem(el, 'Nicole');

expect(el.find('.ui-select-match-item [uis-transclude-append]:not(.ng-hide)').text())
.toBe("Wladimir <[email protected]>Samantha <[email protected]>Nicole <[email protected]>");

setSearchText(el, 'o')
setSearchText(el, 'o');

expect(el.find('.ui-select-match-item [uis-transclude-append]:not(.ng-hide)').text())
.toBe("Wladimir <[email protected]>Samantha <[email protected]>Nicole <[email protected]>");
Expand Down Expand Up @@ -1801,7 +1801,7 @@ describe('ui-select tests', function() {
scope.counter = 0;
scope.onlyOnce = function(){
scope.counter++;
}
};

clickItem(el, 'Nicole');

Expand Down Expand Up @@ -1970,7 +1970,7 @@ describe('ui-select tests', function() {
function checkElements(els) {
for (var i = 0; i < els.length; i++) {
expect(els[i].attributes['aria-label']).toBeTruthy();
};
}
}
}
});
Expand Down