mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
Fix for #747 issue.
This commit is contained in:
@ -79,6 +79,7 @@
|
||||
<TypeScriptCompile Include="apps\action-bar-demo\pages\data-binding.ts">
|
||||
<DependentUpon>data-binding.xml</DependentUpon>
|
||||
</TypeScriptCompile>
|
||||
<TypeScriptCompile Include="apps\tests\ui\action-bar\ActionBar_NumberAsText.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\xml-declaration\custom-code-file.ts" />
|
||||
<TypeScriptCompile Include="apps\transforms\app.ts" />
|
||||
<TypeScriptCompile Include="apps\transforms\main-page.ts" />
|
||||
@ -111,6 +112,7 @@
|
||||
<Content Include="apps\action-bar-demo\pages\center-view-segmented.xml" />
|
||||
<Content Include="apps\action-bar-demo\pages\center-view.xml" />
|
||||
<Content Include="apps\action-bar-demo\pages\data-binding.xml" />
|
||||
<Content Include="apps\tests\ui\action-bar\ActionBar_NumberAsText.xml" />
|
||||
<Content Include="apps\tests\xml-declaration\custom-css-file.css" />
|
||||
<Content Include="apps\transforms\main-page.xml">
|
||||
<SubType>Designer</SubType>
|
||||
|
5
apps/tests/ui/action-bar/ActionBar_NumberAsText.ts
Normal file
5
apps/tests/ui/action-bar/ActionBar_NumberAsText.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import frame = require("ui/frame");
|
||||
|
||||
export function buttonTap(args) {
|
||||
frame.topmost().goBack();
|
||||
}
|
12
apps/tests/ui/action-bar/ActionBar_NumberAsText.xml
Normal file
12
apps/tests/ui/action-bar/ActionBar_NumberAsText.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<Page>
|
||||
<Page.actionBar>
|
||||
<ActionBar title="Service Asset Maintenance">
|
||||
<ActionBar.actionItems>
|
||||
<ActionItem text="1" ios.position="right"/>
|
||||
</ActionBar.actionItems>
|
||||
</ActionBar>
|
||||
</Page.actionBar>
|
||||
<StackLayout>
|
||||
<Button text="Click me" />
|
||||
</StackLayout>
|
||||
</Page>
|
@ -4,6 +4,7 @@ import helper = require("../helper");
|
||||
import builder = require("ui/builder");
|
||||
import button = require("ui/button");
|
||||
import PageModule = require("ui/page");
|
||||
import fs = require("file-system");
|
||||
|
||||
// <snippet module="ui/action-bar" title="ActionBar">
|
||||
// # ActionBar
|
||||
@ -203,3 +204,24 @@ export function test_Setting_ActionItems_doesnt_thrown() {
|
||||
helper.goBack();
|
||||
}
|
||||
}
|
||||
|
||||
export function test_Setting_ActionItemsWithNumberAsText_doesnt_thrown() {
|
||||
|
||||
var gotException = false;
|
||||
|
||||
var moduleName = __dirname.substr(fs.knownFolders.currentApp().path.length);
|
||||
|
||||
try {
|
||||
helper.navigateToModule(moduleName + "/ActionBar_NumberAsText");
|
||||
}
|
||||
catch (e) {
|
||||
gotException = true;
|
||||
}
|
||||
|
||||
try {
|
||||
TKUnit.assert(!gotException, "Expected: false, Actual: " + gotException);
|
||||
}
|
||||
finally {
|
||||
helper.goBack();
|
||||
}
|
||||
}
|
@ -197,7 +197,7 @@ export class ActionBar extends common.ActionBar {
|
||||
menu.clear();
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
var item = items[i];
|
||||
var menuItem = menu.add(android.view.Menu.NONE, i + ACTION_ITEM_ID_OFFSET, android.view.Menu.NONE, item.text);
|
||||
var menuItem = menu.add(android.view.Menu.NONE, i + ACTION_ITEM_ID_OFFSET, android.view.Menu.NONE, item.text + "");
|
||||
if (item.icon) {
|
||||
var drawableOrId = getDrawableOrResourceId(item.icon, this._appResources);
|
||||
if (drawableOrId) {
|
||||
|
@ -52,7 +52,7 @@ export class ActionBar extends common.ActionBar {
|
||||
if (previousController) {
|
||||
if (this.navigationButton) {
|
||||
var tapHandler = TapBarItemHandlerImpl.new().initWithOwner(this.navigationButton);
|
||||
var barButtonItem = UIBarButtonItem.alloc().initWithTitleStyleTargetAction(this.navigationButton.text, UIBarButtonItemStyle.UIBarButtonItemStylePlain, tapHandler, "tap");
|
||||
var barButtonItem = UIBarButtonItem.alloc().initWithTitleStyleTargetAction(this.navigationButton.text + "", UIBarButtonItemStyle.UIBarButtonItemStylePlain, tapHandler, "tap");
|
||||
previousController.navigationItem.backBarButtonItem = barButtonItem;
|
||||
}
|
||||
else {
|
||||
@ -124,7 +124,7 @@ export class ActionBar extends common.ActionBar {
|
||||
}
|
||||
}
|
||||
else {
|
||||
barButtonItem = UIBarButtonItem.alloc().initWithTitleStyleTargetAction(item.text, UIBarButtonItemStyle.UIBarButtonItemStylePlain, tapHandler, "tap");
|
||||
barButtonItem = UIBarButtonItem.alloc().initWithTitleStyleTargetAction(item.text + "", UIBarButtonItemStyle.UIBarButtonItemStylePlain, tapHandler, "tap");
|
||||
}
|
||||
|
||||
return barButtonItem;
|
||||
|
Reference in New Issue
Block a user