-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[TIMOB-25522] iOS: Add "navigationWindow" property to Ti.UI.Window, add unit-tests for all nav-window API's #9608
Changes from 5 commits
c4580dc
385b500
dd57fe3
b23d132
0fc6eba
1cfcf13
d061097
ead8877
25db46e
9825ea2
e1cdf2e
78b5534
ab810d8
1f4ffac
9495cb5
3819ed4
2166687
b737dc7
20742cb
38a908d
596dfa6
4504492
7940c50
96e6da6
796be79
3ce3aab
449f895
c246609
71dd096
49de1f5
f4f9711
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
/* | ||
* 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'), | ||
utilities = require('./utilities/utilities'); | ||
|
||
describe('Titanium.UI.iOS.NavigationWindow', function () { | ||
var win, rootWindow; | ||
|
||
this.timeout(5000); | ||
|
||
// Create and open a root window for the rest of the below child window tests to use as a parent. | ||
// We're not going to close this window until the end of this test suite. | ||
// Note: Android needs this so that closing the last window won't back us out of the app. | ||
before(function (finish) { | ||
rootWindow = Ti.UI.createWindow(); | ||
rootWindow.addEventListener('open', function () { | ||
finish(); | ||
}); | ||
rootWindow.open(); | ||
}); | ||
|
||
after(function (finish) { | ||
rootWindow.addEventListener('close', function () { | ||
finish(); | ||
}); | ||
rootWindow.close(); | ||
}); | ||
|
||
afterEach(function () { | ||
if (win) { | ||
win.close(); | ||
} | ||
win = null; | ||
}); | ||
|
||
it.ios('#openWindow', function () { | ||
var nav = Ti.UI.iOS.createNavigationWindow({ | ||
window: win | ||
}); | ||
|
||
win = Ti.UI.createWindow(); | ||
var subWindow = Ti.UI.createWindow(); | ||
|
||
win.addEventListener('open', function () { | ||
should(nav.openWindow).be.a.function; | ||
nav.openWindow(subWindow); | ||
}); | ||
|
||
subWindow.addEventListener('open', function () { | ||
nav.close(); | ||
finish(); | ||
}); | ||
|
||
nav.open(); | ||
}); | ||
|
||
it.ios('#closeWindow', function () { | ||
var nav = Ti.UI.iOS.createNavigationWindow({ | ||
window: win | ||
}); | ||
|
||
win = Ti.UI.createWindow(); | ||
var subWindow = Ti.UI.createWindow(); | ||
|
||
win.addEventListener('open', function () { | ||
nav.openWindow(subWindow); | ||
}); | ||
|
||
subWindow.addEventListener('open', function () { | ||
should(nav.closeWindow).be.a.function; | ||
nav.closeWindow(subWindow); | ||
}); | ||
|
||
subWindow.addEventListener('close', function () { | ||
finish(); | ||
}); | ||
|
||
nav.open(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is causing a crash/error on each test. I assume you meant to do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mhh, nope, we need to open the navigation window. I am wondering if the following won't cause issues already, because we provide a null-object and set a reference later: var nav = Ti.UI.iOS.createNavigationWindow({
window: win // will be null at this point
});
win = Ti.UI.createWindow(); // now it's getting it's reference? Or we declare the |
||
}); | ||
|
||
it.ios('#popToRootWindow', function () { | ||
var nav = Ti.UI.iOS.createNavigationWindow({ | ||
window: win | ||
}); | ||
|
||
win = Ti.UI.createWindow(); | ||
var subWindow = Ti.UI.createWindow(); | ||
|
||
win.addEventListener('open', function () { | ||
nav.openWindow(subWindow); | ||
}); | ||
|
||
subWindow.addEventListener('open', function () { | ||
should(nav.popToRootWindow).be.a.function; | ||
nav.popToRootWindow(); | ||
finish(); | ||
}); | ||
|
||
nav.open(); | ||
}); | ||
|
||
it.ios('.navigationWindow', function () { | ||
var nav = Ti.UI.iOS.createNavigationWindow({ | ||
window: win | ||
}); | ||
|
||
win = Ti.UI.createWindow(); | ||
|
||
win.addEventListener('open', function () { | ||
should(nav).not.be.undefined; | ||
should(win.navigationWindow).not.be.undefined; | ||
|
||
should(win.navigationWindow).eql(nav); | ||
|
||
should(nav.openWindow).be.a.function; | ||
should(win.navigationWindow.openWindow).be.a.function; | ||
nav.close(); | ||
finish(); | ||
}); | ||
|
||
nav.open(); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, you can just do
describe.ios
at the top to limit all sub-tests to iOS and avoid having to doit.ios
on them all.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing now, thx!