Skip to content

Commit

Permalink
Android: Added "SearchBar" unit test to [TIMOB-25832]
Browse files Browse the repository at this point in the history
  • Loading branch information
jquick-axway committed Apr 13, 2019
1 parent 451678a commit adaa7f7
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions tests/Resources/ti.ui.searchbar.addontest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Appcelerator Titanium Mobile
* Copyright (c) 2011-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 */
/* global Ti */
/* eslint no-unused-expressions: "off" */
'use strict';
var should = require('./utilities/assertions');

describe('Titanium.UI.SearchBar', function () {
var win;

afterEach(function () {
if (win) {
win.close();
}
win = null;
});

it('Change hintText dynamically', function (finish) {
this.timeout(5000);

const OLD_HINT_TEXT = 'Old Hint Text';
const NEW_HINT_TEXT = 'New Hint Text';
const searchBar = Ti.UI.createSearchBar({
hintText: OLD_HINT_TEXT,
});
should(searchBar.hintText).eql(OLD_HINT_TEXT);
win = Ti.UI.createWindow();
win.add(searchBar);
win.addEventListener('open', function () {
try {
should(searchBar.hintText).eql(OLD_HINT_TEXT);
searchBar.hintText = NEW_HINT_TEXT;
should(searchBar.hintText).eql(NEW_HINT_TEXT);
} catch (err) {
finish(err);
return;
}
setTimeout(function () {
try {
should(searchBar.hintText).eql(NEW_HINT_TEXT);
finish();
} catch (err) {
finish(err);
}
}, 100);
});
win.open();
});
});

0 comments on commit adaa7f7

Please sign in to comment.