Files
NativeScript/tests/app/ui/button/button-tests-native.ios.ts
Panayot Cankov 1236f66f44 Add npm script that generates ios .d.ts-es from the tests app
Less than 30 erros left, let's hope it still works

Added lib.*.d.ts from typescript, removed lib and dom stuff, added by hand XHR, alert etc. .d.ts-es for polyfills

Roll back some changes involved in separating UIEvent for dom and ios

Test combined dts-es will now use lib, while internally we will not to avoid UIEvent conflict with dom stuff
2016-08-29 09:58:17 +03:00

42 lines
1.5 KiB
TypeScript

import buttonModule = require("ui/button");
import colorModule = require("color");
import utilsModule = require("utils/utils");
import enums = require("ui/enums");
export function getNativeText(button: buttonModule.Button): string {
return button.ios.titleForState(UIControlState.Normal);
}
export function getNativeTextWrap(button: buttonModule.Button): boolean {
return (<UIButton>button.ios).titleLabel.lineBreakMode === NSLineBreakMode.ByWordWrapping;
}
export function getNativeFontSize(button: buttonModule.Button): number {
return button.ios.titleLabel.font.pointSize;
}
export function getNativeColor(button: buttonModule.Button): colorModule.Color {
return utilsModule.ios.getColor(button.ios.titleColorForState(UIControlState.Normal));
}
export function getNativeBackgroundColor(button: buttonModule.Button): colorModule.Color {
return utilsModule.ios.getColor(button.ios.backgroundColor);
}
export function getNativeTextAlignment(button: buttonModule.Button): string {
switch (button.ios.titleLabel.textAlignment) {
case NSTextAlignment.Left:
return enums.TextAlignment.left;
case NSTextAlignment.Center:
return enums.TextAlignment.center;
case NSTextAlignment.Right:
return enums.TextAlignment.right;
default:
return "unexpected value";
}
}
export function performNativeClick(button: buttonModule.Button): void {
button.ios.sendActionsForControlEvents(UIControlEvents.TouchUpInside);
}