diff --git a/lib/clientsidescripts.js b/lib/clientsidescripts.js index 42ee0c9e6..784cbf9d1 100644 --- a/lib/clientsidescripts.js +++ b/lib/clientsidescripts.js @@ -94,7 +94,7 @@ clientSideScripts.findBindings = function() { } } } - return rows[index - 1]; + return rows[index]; }; /** @@ -153,7 +153,7 @@ clientSideScripts.findRepeaterElement = function() { } } } - var row = rows[index - 1]; + var row = rows[index]; var bindings = []; if (row.className.indexOf('ng-binding') != -1) { bindings.push(row); diff --git a/spec/findelements_spec.js b/spec/findelements_spec.js index f3e79569c..d1ddec830 100644 --- a/spec/findelements_spec.js +++ b/spec/findelements_spec.js @@ -101,15 +101,15 @@ describe('finding elements', function() { it('should find by partial match', function() { var fullMatch = ptor.findElement( protractor.By.repeater('baz in days | filter:\'T\''). - row(1).column('{{baz}}')); + row(0).column('{{baz}}')); expect(fullMatch.getText()).toEqual('Tue'); var partialMatch = ptor.findElement( - protractor.By.repeater('baz in days').row(1).column('b')); + protractor.By.repeater('baz in days').row(0).column('b')); expect(partialMatch.getText()).toEqual('Tue'); var partialRowMatch = ptor.findElement( - protractor.By.repeater('baz in days').row(1)); + protractor.By.repeater('baz in days').row(0)); expect(partialRowMatch.getText()).toEqual('Tue'); }); @@ -137,20 +137,20 @@ describe('finding elements', function() { it('should return a single row', function() { var secondRow = ptor.findElement( - protractor.By.repeater('dayColor in dayColors').row(2)); + protractor.By.repeater('dayColor in dayColors').row(1)); expect(secondRow.getText()).toEqual('Tue green'); }); it('should return an individual cell', function() { var secondColor = ptor.findElement( protractor.By.repeater('dayColor in dayColors'). - row(2). + row(1). column('color')); var secondColorByColumnFirst = ptor.findElement( protractor.By.repeater('dayColor in dayColors'). column('color'). - row(2)); + row(1)); expect(secondColor.getText()).toEqual('green'); expect(secondColorByColumnFirst.getText()).toEqual('green'); @@ -158,44 +158,44 @@ describe('finding elements', function() { it('should find a using data-ng-repeat', function() { var byRow = - ptor.findElement(protractor.By.repeater('day in days').row(3)); + ptor.findElement(protractor.By.repeater('day in days').row(2)); expect(byRow.getText()).toEqual('Wed'); var byCol = - ptor.findElement(protractor.By.repeater('day in days').row(3). + ptor.findElement(protractor.By.repeater('day in days').row(2). column('day')); expect(byCol.getText()).toEqual('Wed'); }); it('should find using ng:repeat', function() { var byRow = - ptor.findElement(protractor.By.repeater('bar in days').row(3)); + ptor.findElement(protractor.By.repeater('bar in days').row(2)); expect(byRow.getText()).toEqual('Wed'); var byCol = - ptor.findElement(protractor.By.repeater('bar in days').row(3). + ptor.findElement(protractor.By.repeater('bar in days').row(2). column('bar')); expect(byCol.getText()).toEqual('Wed'); }); it('should find using ng_repeat', function() { var byRow = - ptor.findElement(protractor.By.repeater('foo in days').row(3)); + ptor.findElement(protractor.By.repeater('foo in days').row(2)); expect(byRow.getText()).toEqual('Wed'); var byCol = - ptor.findElement(protractor.By.repeater('foo in days').row(3). + ptor.findElement(protractor.By.repeater('foo in days').row(2). column('foo')); expect(byCol.getText()).toEqual('Wed'); }); it('should find using x-ng-repeat', function() { var byRow = - ptor.findElement(protractor.By.repeater('qux in days').row(3)); + ptor.findElement(protractor.By.repeater('qux in days').row(2)); expect(byRow.getText()).toEqual('Wed'); var byCol = - ptor.findElement(protractor.By.repeater('qux in days').row(3). + ptor.findElement(protractor.By.repeater('qux in days').row(2). column('qux')); expect(byCol.getText()).toEqual('Wed'); }); @@ -230,12 +230,12 @@ describe('finding elements', function() { it('should find elements using a repeater', function() { // Returns the element for the entire row. expect( - ptor.findElement(protractor.By.repeater('ball in planets').row(3)). + ptor.findElement(protractor.By.repeater('ball in planets').row(2)). getText()).toEqual('Earth:3'); // Returns the element in row 2 and the column with binding {{ball.name}} expect( - ptor.findElement(protractor.By.repeater('ball in planets').row(2). + ptor.findElement(protractor.By.repeater('ball in planets').row(1). column('{{ball.name}}')).getText()).toEqual('Venus'); // Returns the entire column. diff --git a/spec/testapp_spec.js b/spec/testapp_spec.js index deb5829ef..5188f23c2 100644 --- a/spec/testapp_spec.js +++ b/spec/testapp_spec.js @@ -44,7 +44,7 @@ describe('longer example', function() { var addOneButton = ptor.findElement(protractor.By.id('addone')); addOneButton.click(); var topNumber = ptor.findElement( - protractor.By.repeater('foo in foos').row(1). + protractor.By.repeater('foo in foos').row(0). column('{{foo.b}}')); expect(topNumber.getText()).toEqual('14930352'); @@ -52,7 +52,7 @@ describe('longer example', function() { addOneButton.click(); topNumber = ptor.findElement( - protractor.By.repeater('foo in foos').row(1). + protractor.By.repeater('foo in foos').row(0). column('{{foo.b}}')); expect(topNumber.getText()).toEqual('24157817'); @@ -60,4 +60,4 @@ describe('longer example', function() { }); }); -}); \ No newline at end of file +});