Skip to content

Commit

Permalink
Fixed the test scenario for editable cells.
Browse files Browse the repository at this point in the history
I had to inject $sniffer and conditionally use the 'input' event in browserTrigger() rather than 'change'. Not sure why yet, but it works!
  • Loading branch information
c0bra committed May 28, 2013
1 parent f244363 commit ee2a5f1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions test/unit/directivesSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,12 @@ describe('directives', function () {

describe('column', function () {
describe('cell editing', function () {
var elm, element, $scope, $compile;
var elm, element, $scope, $compile, $sniffer

beforeEach(inject(function ($rootScope, _$compile_) {
beforeEach(inject(function ($rootScope, _$compile_, _$sniffer_) {
$compile = _$compile_;
$scope = $rootScope;
$sniffer = _$sniffer_;
elm = angular.element(
'<div ng-grid="gridOptions" style="width: 1000px; height: 1000px"></div>'
);
Expand Down Expand Up @@ -233,10 +234,7 @@ describe('directives', function () {
var testName = 'Test Name';
input.val(testName);

expect(function(){
// Trigger the input handler
input.triggerHandler('keyup');
}).not.toThrow();
browserTrigger(input, $sniffer.hasEvent('input') ? 'input' : 'change');

// The value of the input should stay 'Test'
expect(input.val()).toEqual(testName);
Expand Down

0 comments on commit ee2a5f1

Please sign in to comment.