Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ios): set tintcolor of UIBarButtonItem #12245

Merged
merged 12 commits into from
Nov 20, 2020
1 change: 1 addition & 0 deletions iphone/Classes/TiUINavBarButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ - (id)initWithProxy:(TiUIButtonProxy *)proxy_
self = [super initWithImage:theimage style:[self style:proxy_] target:self action:@selector(clicked:)];
} else {
self = [super initWithTitle:[self title:proxy_] style:[self style:proxy_] target:self action:@selector(clicked:)];
self.tintColor = [TiUtils colorValue:[proxy_ valueForKey:@"color"]].color;
vijaysingh-axway marked this conversation as resolved.
Show resolved Hide resolved
}
}
proxy = proxy_; // Don't retain
Expand Down
80 changes: 80 additions & 0 deletions tests/Resources/ti.ui.window.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,86 @@ describe('Titanium.UI.Window', function () {
});
});

it.ios('#leftNavButtons and #rightNavButtons', finish => {
vijaysingh-axway marked this conversation as resolved.
Show resolved Hide resolved
var rightButton1 = Ti.UI.createButton({
vijaysingh-axway marked this conversation as resolved.
Show resolved Hide resolved
title: 'Right1',
color: 'green',
});

var rightButton2 = Ti.UI.createButton({
vijaysingh-axway marked this conversation as resolved.
Show resolved Hide resolved
title: 'Right2',
color: 'green',
});

var leftButton = Ti.UI.createButton({
vijaysingh-axway marked this conversation as resolved.
Show resolved Hide resolved
title: 'Left',
color: 'blue'
});

var rootWindow = Ti.UI.createWindow({
vijaysingh-axway marked this conversation as resolved.
Show resolved Hide resolved
backgroundColor: 'white',
leftNavButtons: [ leftButton ],
rightNavButtons: [ rightButton1, rightButton2 ],
});

win = Ti.UI.createNavigationWindow({
window: rootWindow
});

win.open();

rootWindow.addEventListener('focus', function () {
vijaysingh-axway marked this conversation as resolved.
Show resolved Hide resolved
try {
should(rootWindow.rightNavButtons).be.an.Array();
should(rootWindow.rightNavButtons.length).be.eql(2);
rootWindow.rightNavButtons = [ rightButton1 ];
should(rootWindow.rightNavButtons.length).be.eql(1);

should(rootWindow.leftNavButtons).be.an.Array();
should(rootWindow.leftNavButtons.length).be.eql(1);
} catch (e) {
return finish(e);
}
finish();
});
});

it.ios('#leftNavButton and #rightNavButton', finish => {
var rightButton = Ti.UI.createButton({
title: 'Right',
color: 'green',
});

var leftButton = Ti.UI.createButton({
title: 'Left',
color: 'blue'
});

var rootWindow = Ti.UI.createWindow({
backgroundColor: 'white',
leftNavButton: leftButton,
rightNavButton: rightButton,
});

win = Ti.UI.createNavigationWindow({
window: rootWindow
});

win.open();

rootWindow.addEventListener('postlayout', function postlayout() {
rootWindow.removeEventListener('postlayout', postlayout);
try {
should(rootWindow.leftNavButton).be.an.Object();
vijaysingh-axway marked this conversation as resolved.
Show resolved Hide resolved
should(rootWindow.rightNavButton).be.an.Object();
// Can we match different simulators window snapshot
} catch (e) {
return finish(e);
}
finish();
});
});

// FIXME Move these rect/size tests into Ti.UI.View!
it.windowsBroken('.size is read-only', finish => {
win = Ti.UI.createWindow({
Expand Down