Skip to content

Commit

Permalink
fix(ios): TableViewRow does not return getRect methods (#11758)
Browse files Browse the repository at this point in the history
* fix(ios): TableViewRow does not return getRect methods

* test(ios): added unit test

Co-authored-by: ssekhri <ssekhri@axway.com>
  • Loading branch information
vijaysingh-axway and ssekhri committed Jun 11, 2020
1 parent 54e42b1 commit b15d184
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
3 changes: 2 additions & 1 deletion iphone/Classes/TiUITableViewRowProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,8 @@ - (TiProxy *)parentForBubbling

- (UIView *)view
{
return nil;
//TIMOB-27935: TiUITableViewRowProxy do not have corresponding view class. So return corresponding cell
return callbackCell;
}

//Private method : For internal use only
Expand Down
64 changes: 64 additions & 0 deletions tests/Resources/ti.ui.tableview.addontest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Appcelerator Titanium Mobile
* Copyright (c) 2015-Present by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
/* eslint-env mocha */
/* eslint no-unused-expressions: "off" */
'use strict';
const should = require('./utilities/assertions');

describe('Titanium.UI.TableView', function () {
let win;

this.timeout(5000);

afterEach(function (done) {
if (win) {
// If `win` is already closed, we're done.
let t = setTimeout(function () {
if (win) {
win = null;
done();
}
}, 3000);

win.addEventListener('close', function listener () {
clearTimeout(t);

if (win) {
win.removeEventListener('close', listener);
}
win = null;
done();
});
win.close();
} else {
win = null;
done();
}
});

it.ios('row#rect', function (finish) {
win = Ti.UI.createWindow();
const tableView = Ti.UI.createTableView();
const row = Ti.UI.createTableViewRow({
height: Ti.UI.SIZE,
width: Ti.UI.FILL
});
const view = Ti.UI.createView({
height: 150,
backgroundColor: 'yellow'
});
row.add(view);
tableView.setData([ row ]);
win.add(tableView);

row.addEventListener('postlayout', function () {
should(row.rect.height).be.eql(150);
finish();
});
win.open();
});
});

0 comments on commit b15d184

Please sign in to comment.