Permalink
Browse files

Update kraniumdemo

  • Loading branch information...
Jacob Waller
Jacob Waller committed Sep 14, 2011
1 parent 47f0629 commit 85ee0e978f34ff83b706752ed2a39d7566eea7ff
View
@@ -1,64 +0,0 @@
-// this sets the background color of the master UIView (when there are no windows/tab groups on it)
-Titanium.UI.setBackgroundColor('#000');
-
-// create tab group
-var tabGroup = Titanium.UI.createTabGroup();
-
-
-//
-// create base UI tab and root window
-//
-var win1 = Titanium.UI.createWindow({
- title:'Tab 1',
- backgroundColor:'#fff'
-});
-var tab1 = Titanium.UI.createTab({
- icon:'KS_nav_views.png',
- title:'Tab 1',
- window:win1
-});
-
-var label1 = Titanium.UI.createLabel({
- color:'#999',
- text:'I am Window 1',
- font:{fontSize:20,fontFamily:'Helvetica Neue'},
- textAlign:'center',
- width:'auto'
-});
-
-win1.add(label1);
-
-//
-// create controls tab and root window
-//
-var win2 = Titanium.UI.createWindow({
- title:'Tab 2',
- backgroundColor:'#fff'
-});
-var tab2 = Titanium.UI.createTab({
- icon:'KS_nav_ui.png',
- title:'Tab 2',
- window:win2
-});
-
-var label2 = Titanium.UI.createLabel({
- color:'#999',
- text:'I am Window 2',
- font:{fontSize:20,fontFamily:'Helvetica Neue'},
- textAlign:'center',
- width:'auto'
-});
-
-win2.add(label2);
-
-
-
-//
-// add tabs
-//
-tabGroup.addTab(tab1);
-tabGroup.addTab(tab2);
-
-
-// open tab group
-tabGroup.open();
View
@@ -1,14 +0,0 @@
-Ti.include("kranium.js");
-
-K({
- type: 'tabgroup',
- tabs: [{
- title: 'test',
- window: {
- children: [{
- type: 'coffeedemo',
- text: 'what goes around'
- }]
- }
- }]
-}).open();
View
@@ -1,14 +0,0 @@
-Ti.include("kranium/lib/kranium.js");
-
-K({
- type: 'tabgroup',
- tabs: [{
- title: 'test',
- window: {
- children: [{
- type: 'coffeedemo',
- text: 'what goes around'
- }]
- }
- }]
-}).open();
View
@@ -0,0 +1,8 @@
+tmp
+build
+api.jsca
+.settings
+.project
+.monitor
+.fastdev.lock
+build.log
View
@@ -1,29 +1,17 @@
Ti.include("/kranium/lib/kranium.js");
+//Ti.include("jade.js");
K({
type: 'tabgroup',
tabs: [{
title: 'Coffee Demo',
window: {
- children: [{
- type: 'coffeedemo',
- text: 'what goes around'
- }]
+ //type: 'window',
+ id: 'hu',
+ //children: ['label heja']
}
- },
- /*{
- title: 'Backbone Demo',
- window: {
- id: 'backbonewindow',
- rightNavButton: {
- systemButton: Titanium.UI.iPhone.SystemButton.ADD,
- click: function(){
- Ti.App.fireEvent('backbonewindowadd', { value: this.editing });
- }
- },
- children: [{
- type: 'backbonedemo'
- }]
- }
- }*/]
-}).open();
+ }]
+}).open();
+
+
+J('test.jade', {users: { jacob: 'yeah' }}).css({ top: 10, left: 20 }).appendTo('#hu');
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -0,0 +1,4 @@
+- var title = "Things"
+label= title
+view
+ label hej
@@ -2,8 +2,10 @@
(function(global){
if(global.BOOTSTRAPPED){ return; }
global.DEBUG = false;
- global.USE_BACKBONE = true;
- global.TEST = false;
+ global.USE_BACKBONE = false;
+ global.TEST = true;
global.BOOTSTRAPPED = true;
- K.watch("10.66.22.62", "8128");
+if(K.is.ios){
+ K.watch("10.66.23.180", "8128");
+}
})(this);
View
@@ -16,7 +16,7 @@ exports.Class = View.extend
text: "swipe me"
events:
swipe: (e) ->
- K.log e
+ alert e
app:
pause: (e) ->
@text = "Don't you dare pausing me!"
@@ -26,7 +26,7 @@ exports.Class = View.extend
type: "button"
title: "click me"
click: (e) ->
- K.log e
+ alert e
}
{
className: "demoitem coffeetable"

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -0,0 +1,114 @@
+(function(){
+
+ // To learn how to write Jasmine tests, please read Jasmine documentation:
+ // https://github.com/pivotal/jasmine/wiki
+
+ describe('Core', function() {
+ var view = K.createView(),
+ label = K.createLabel(),
+ button = K.createButton();
+
+ describe('methods', function(){
+ it('stringify', function(){
+ expect(
+ K([label, view]).stringify()
+ ).toEqual('["<label></label>", "<view></view>"]');
+ });
+
+ it('get array of all elements', function(){
+ expect(
+ K.stringify(
+ K(
+ [K.createLabel({ text: "get" }), view]
+ ).get()
+ )
+ ).toEqual('["<label>get</label>", "<view></view>"]');
+ });
+
+ it('get first element found', function(){
+ expect(
+ K.stringify(
+ K(
+ [K.createLabel({ text: "get" }), view]
+ ).get(0)
+ )
+ ).toEqual('"<label>get</label>"');
+ });
+
+ it('size', function(){
+ expect(
+ K([label, view, button]).size()
+ ).toEqual(3);
+ });
+
+ it('index(element)', function(){
+ var view = K.createView();
+ expect(
+ K([label, view, button]).index(view)
+ ).toEqual(1);
+ });
+
+ it('first', function(){
+ expect(
+ K([view, label, button]).first().stringify()
+ ).toEqual('["<view></view>"]');
+ });
+
+ it('last', function(){
+ expect(
+ K([view, label, button]).last().stringify()
+ ).toEqual('["<button></button>"]');
+ });
+
+ it('add', function(){
+ expect(
+ K([view, label]).add(button).stringify()
+ ).toEqual('["<view></view>", "<label></label>", "<button></button>"]');
+ });
+
+ it('find', function(){
+
+ expect(
+ K({
+ type: 'view',
+ children: [{
+ type: 'label',
+ text: 'not'
+ },
+ {
+ type: 'view',
+ children: [{
+ type: 'label',
+ className: 'me',
+ text: 'me'
+ }]
+ }]
+ }).find('label.me').stringify()
+ ).toEqual('["<label class=\'me\'>me</label>"]');
+ });
+
+ it('closest("selector")', function(){
+ expect(
+ K({
+ type: 'view',
+ className: 'view1',
+ children: [{
+ type: 'label',
+ text: 'not'
+ },
+ {
+ type: 'view',
+ className: 'view2',
+ children: [{
+ type: 'label',
+ className: 'me',
+ text: 'me'
+ }]
+ }]
+ }).find('label.me').closest('view').stringify()
+ ).toEqual('["<view class=\'view2\'></view>"]');
+ });
+ });
+ });
+
+})();
@@ -0,0 +1 @@
+this.tests_enabled = true;
Oops, something went wrong.

0 comments on commit 85ee0e9

Please sign in to comment.