Skip to content

Commit 5c4dbde

Browse files
committed
Add unit test for SearchBar.textFieldHintColor on iOS
Related to NativeScript#1807
1 parent 921d718 commit 5c4dbde

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed
Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
import colorModule = require("color");
2-
import searchBarModule = require("ui/search-bar");
1+
import { SearchBar } from "ui/search-bar";
2+
import { Color } from "color";
3+
import * as utils from "utils/utils";
34

4-
export function getNativeHintColor(searchBar: searchBarModule.SearchBar): colorModule.Color {
5-
// TODO: This test needs to be created
6-
return undefined;
5+
export function getNativeHintColor(searchBar: SearchBar): Color {
6+
return (<any>searchBar)._placeholderLabel ? utils.ios.getColor((<any>searchBar)._placeholderLabel.textColor) : undefined;
77
}
8-
export function getNativeFontSize(searchBar: searchBarModule.SearchBar): number {
9-
var sf = <UITextField>(<any>searchBar)._textField;
10-
if (sf) {
11-
return sf.font.pointSize;
12-
}
13-
14-
return undefined;
8+
export function getNativeFontSize(searchBar: SearchBar): number {
9+
return (<any>searchBar)._textField ? (<any>searchBar)._textField.font.pointSize : undefined;
1510
}
1611

tests/app/ui/search-bar/search-bar-tests.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ export var testSearchBarHintColorAndroid = function () {
2828
helper.buildUIAndRunTest(_createSearchBarFunc(), function (views: Array<viewModule.View>) {
2929
var searchBar = <searchBarModule.SearchBar>views[0];
3030

31-
// TODO: create IOS test once IOS support is working
32-
if (!searchBar.android) {
33-
return;
34-
}
35-
3631
searchBar.text = "";
3732
searchBar.hint = "hint color test";
3833

0 commit comments

Comments
 (0)