diff --git a/dist/ionic.js b/dist/ionic.js index 8e4de8f16b..15a752b57a 100644 --- a/dist/ionic.js +++ b/dist/ionic.js @@ -1,5 +1,9 @@ window.ionic = {}; +// Create namespaces +ionic.controllers = {}; +ionic.views = {}; + function initalize() { // remove the ready listeners document.removeEventListener( "DOMContentLoaded", initalize, false ); @@ -64,7 +68,7 @@ if ( document.readyState === "complete" ) { } ionic.Platform.detect(); -})(ionic = window.ionic || {}); +})(window.ionic); ;(function(ionic) { ionic.Utils = { @@ -86,7 +90,7 @@ if ( document.readyState === "complete" ) { return dest; }, } -})(ionic = window.ionic || {}); +})(window.ionic); ;/** * ion-events.js * @@ -195,7 +199,7 @@ if ( document.readyState === "complete" ) { // Set up various listeners window.addEventListener('click', ionic.EventController.handleClick); -})(ionic = window.ionic || {}); +})(window.ionic); ;/** * Simple gesture controllers with some common gestures that emit * gesture events. @@ -1623,7 +1627,7 @@ if ( document.readyState === "complete" ) { } } }; -})(ionic = window.ionic || {}); +})(window.ionic); ;(function(ionic) { ionic.Animator = { animate: function(element, className, fn) { @@ -1666,7 +1670,7 @@ if ( document.readyState === "complete" ) { }; } }; -})(ionic = window.ionic || {}); +})(window.ionic); ;(function(ionic) { ionic.ViewController = function(options) { this.init(); @@ -1680,18 +1684,16 @@ if ( document.readyState === "complete" ) { destroy: function() { } }; -})(ionic = window.ionic || {}); +})(window.ionic); ;(function(ionic) { -ionic.ui = ionic.ui || {}; - -ionic.ui.NavBar = function(opts) { +ionic.views.NavBar = function(opts) { this.el = opts.el; this._titleEl = this.el.querySelector('.title'); }; -ionic.ui.NavBar.prototype = { +ionic.views.NavBar.prototype = { shouldGoBack: function() {}, setTitle: function(title) { @@ -1724,18 +1726,18 @@ ionic.ui.NavBar.prototype = { } } }; -})(ionic = window.ionic || {}); +})(window.ionic); ;(function(ionic) { -ionic.ui = ionic.ui || {}; +ionic.views = ionic.views || {}; -ionic.ui.SideMenu = function(opts) { +ionic.views.SideMenu = function(opts) { this.el = opts.el; this.width = opts.width; this.isEnabled = opts.isEnabled || true; }; -ionic.ui.SideMenu.prototype = { +ionic.views.SideMenu.prototype = { getFullWidth: function() { return this.width; }, @@ -1749,17 +1751,15 @@ ionic.ui.SideMenu.prototype = { this.el.style.zIndex = -1; } }; -})(ionic = window.ionic || {}); +})(window.ionic); ;(function(ionic) { -ionic.ui = ionic.ui || {}; - -ionic.ui.TabBarItem = function(el) { +ionic.views.TabBarItem = function(el) { this.el = el; this._buildItem(); }; -ionic.ui.TabBarItem.prototype = { +ionic.views.TabBarItem.prototype = { // Factory for creating an item from a given javascript object create: function(itemData) { var item = document.createElement('a'); @@ -1773,7 +1773,7 @@ ionic.ui.TabBarItem.prototype = { } item.appendChild(document.createTextNode(itemData.title)); - return new ionic.ui.TabBarItem(item); + return new ionic.views.TabBarItem(item); }, @@ -1828,7 +1828,7 @@ ionic.ui.TabBarItem.prototype = { } }; -ionic.ui.TabBar = function(opts) { +ionic.views.TabBar = function(opts) { this.el = opts.el; this.items = []; @@ -1836,7 +1836,7 @@ ionic.ui.TabBar = function(opts) { this._buildItems(); }; -ionic.ui.TabBar.prototype = { +ionic.views.TabBar.prototype = { // get all the items for the TabBar getItems: function() { return this.items; @@ -1845,7 +1845,7 @@ ionic.ui.TabBar.prototype = { // Add an item to the tab bar addItem: function(item) { // Create a new TabItem - var tabItem = ionic.ui.TabBarItem.prototype.create(item); + var tabItem = ionic.views.TabBarItem.prototype.create(item); this.appendItemElement(tabItem); @@ -1932,7 +1932,7 @@ ionic.ui.TabBar.prototype = { var item, items = Array.prototype.slice.call(this.el.children); for(var i = 0, j = items.length; i < j; i += 1) { - item = new ionic.ui.TabBarItem(items[i]); + item = new ionic.views.TabBarItem(items[i]); this.items[i] = item; this._bindEventsOnItem(item); } @@ -1952,11 +1952,9 @@ ionic.ui.TabBar.prototype = { } }; -})(ionic = window.ionic || {}); +})(window.ionic); ;(function(ionic) { -ionic.controllers = ionic.controllers || {}; - ionic.controllers.NavController = function(opts) { var _this = this; @@ -2060,7 +2058,7 @@ ionic.controllers.NavController.prototype = { }, }; -})(ionic = window.ionic || {}); +})(window.ionic); ;(function(ionic) { ionic.controllers = ionic.controllers || {}; diff --git a/ionic.conf.js b/ionic.conf.js index 3b2767726b..44ee9c0481 100644 --- a/ionic.conf.js +++ b/ionic.conf.js @@ -19,12 +19,11 @@ module.exports = function(config) { 'https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js', 'vendor/angular/1.2.0rc1/*', - 'js/ionic-events.js', - 'js/ionic-gestures.js', - 'test/utils/**/*.js', + 'dist/ionic.js', + 'test/**/*.js', //'ext/angular/src/**/*.js', //'ext/angular/test/**/*.js', - 'hacking/**/*.js', + //'hacking/**/*.js', //'test/**/*.js' ], diff --git a/js/animate.js b/js/animate.js index c394117eb6..bedaad67b2 100644 --- a/js/animate.js +++ b/js/animate.js @@ -40,4 +40,4 @@ }; } }; -})(ionic = window.ionic || {}); +})(window.ionic); diff --git a/js/controllers/navController.js b/js/controllers/navController.js index 5c5ba1e052..22345eae8e 100644 --- a/js/controllers/navController.js +++ b/js/controllers/navController.js @@ -1,7 +1,5 @@ (function(ionic) { -ionic.controllers = ionic.controllers || {}; - ionic.controllers.NavController = function(opts) { var _this = this; @@ -105,4 +103,4 @@ ionic.controllers.NavController.prototype = { }, }; -})(ionic = window.ionic || {}); +})(window.ionic); diff --git a/js/events.js b/js/events.js index 0a5c894e91..62f03f992b 100644 --- a/js/events.js +++ b/js/events.js @@ -106,4 +106,4 @@ // Set up various listeners window.addEventListener('click', ionic.EventController.handleClick); -})(ionic = window.ionic || {}); +})(window.ionic); diff --git a/js/gestures.js b/js/gestures.js index d111d92806..7dbb356e2e 100644 --- a/js/gestures.js +++ b/js/gestures.js @@ -1425,4 +1425,4 @@ } } }; -})(ionic = window.ionic || {}); +})(window.ionic); diff --git a/js/ionic.js b/js/ionic.js index c61d39b2be..b4c7b0e7cc 100644 --- a/js/ionic.js +++ b/js/ionic.js @@ -1,5 +1,9 @@ window.ionic = {}; +// Create namespaces +ionic.controllers = {}; +ionic.views = {}; + function initalize() { // remove the ready listeners document.removeEventListener( "DOMContentLoaded", initalize, false ); diff --git a/js/platform.js b/js/platform.js index 51f25f8763..90aa6b7666 100644 --- a/js/platform.js +++ b/js/platform.js @@ -36,4 +36,4 @@ } ionic.Platform.detect(); -})(ionic = window.ionic || {}); +})(window.ionic); diff --git a/js/utils.js b/js/utils.js index 43094aa59b..c6cecece1f 100644 --- a/js/utils.js +++ b/js/utils.js @@ -19,4 +19,4 @@ return dest; }, } -})(ionic = window.ionic || {}); +})(window.ionic); diff --git a/js/viewController.js b/js/viewController.js index 2a0583d45c..5803e3808c 100644 --- a/js/viewController.js +++ b/js/viewController.js @@ -11,4 +11,4 @@ destroy: function() { } }; -})(ionic = window.ionic || {}); +})(window.ionic); diff --git a/js/views/navBar.js b/js/views/navBar.js index 83594523b2..18fb1ffbc6 100644 --- a/js/views/navBar.js +++ b/js/views/navBar.js @@ -1,14 +1,12 @@ (function(ionic) { -ionic.ui = ionic.ui || {}; - -ionic.ui.NavBar = function(opts) { +ionic.views.NavBar = function(opts) { this.el = opts.el; this._titleEl = this.el.querySelector('.title'); }; -ionic.ui.NavBar.prototype = { +ionic.views.NavBar.prototype = { shouldGoBack: function() {}, setTitle: function(title) { @@ -41,4 +39,4 @@ ionic.ui.NavBar.prototype = { } } }; -})(ionic = window.ionic || {}); +})(window.ionic); diff --git a/js/views/sideMenu.js b/js/views/sideMenu.js index f577331b3d..71cf458b49 100644 --- a/js/views/sideMenu.js +++ b/js/views/sideMenu.js @@ -1,14 +1,14 @@ (function(ionic) { -ionic.ui = ionic.ui || {}; +ionic.views = ionic.views || {}; -ionic.ui.SideMenu = function(opts) { +ionic.views.SideMenu = function(opts) { this.el = opts.el; this.width = opts.width; this.isEnabled = opts.isEnabled || true; }; -ionic.ui.SideMenu.prototype = { +ionic.views.SideMenu.prototype = { getFullWidth: function() { return this.width; }, @@ -22,4 +22,4 @@ ionic.ui.SideMenu.prototype = { this.el.style.zIndex = -1; } }; -})(ionic = window.ionic || {}); +})(window.ionic); diff --git a/js/views/tabBar.js b/js/views/tabBar.js index 2fc8ed68eb..b26f7b4b4c 100644 --- a/js/views/tabBar.js +++ b/js/views/tabBar.js @@ -1,13 +1,11 @@ (function(ionic) { -ionic.ui = ionic.ui || {}; - -ionic.ui.TabBarItem = function(el) { +ionic.views.TabBarItem = function(el) { this.el = el; this._buildItem(); }; -ionic.ui.TabBarItem.prototype = { +ionic.views.TabBarItem.prototype = { // Factory for creating an item from a given javascript object create: function(itemData) { var item = document.createElement('a'); @@ -21,7 +19,7 @@ ionic.ui.TabBarItem.prototype = { } item.appendChild(document.createTextNode(itemData.title)); - return new ionic.ui.TabBarItem(item); + return new ionic.views.TabBarItem(item); }, @@ -76,7 +74,7 @@ ionic.ui.TabBarItem.prototype = { } }; -ionic.ui.TabBar = function(opts) { +ionic.views.TabBar = function(opts) { this.el = opts.el; this.items = []; @@ -84,7 +82,7 @@ ionic.ui.TabBar = function(opts) { this._buildItems(); }; -ionic.ui.TabBar.prototype = { +ionic.views.TabBar.prototype = { // get all the items for the TabBar getItems: function() { return this.items; @@ -93,7 +91,7 @@ ionic.ui.TabBar.prototype = { // Add an item to the tab bar addItem: function(item) { // Create a new TabItem - var tabItem = ionic.ui.TabBarItem.prototype.create(item); + var tabItem = ionic.views.TabBarItem.prototype.create(item); this.appendItemElement(tabItem); @@ -180,7 +178,7 @@ ionic.ui.TabBar.prototype = { var item, items = Array.prototype.slice.call(this.el.children); for(var i = 0, j = items.length; i < j; i += 1) { - item = new ionic.ui.TabBarItem(items[i]); + item = new ionic.views.TabBarItem(items[i]); this.items[i] = item; this._bindEventsOnItem(item); } @@ -200,4 +198,4 @@ ionic.ui.TabBar.prototype = { } }; -})(ionic = window.ionic || {}); +})(window.ionic); diff --git a/hacking/NavController.unit.js b/test/js/controllers/navController.unit.js similarity index 87% rename from hacking/NavController.unit.js rename to test/js/controllers/navController.unit.js index 0f8fdd2fb0..5b22922ac4 100644 --- a/hacking/NavController.unit.js +++ b/test/js/controllers/navController.unit.js @@ -17,15 +17,15 @@ describe('NavController', function() { navBarEl = document.createElement('div'); contentEl = document.createElement('div'); - ctrl = new NavController({ - navBar: new NavBar({el: navBarEl }), + ctrl = new ionic.controllers.NavController({ + navBar: new ionic.views.NavBar({el: navBarEl }), content: { el: contentEl } }); }); it('Should load controllers', function() { - ctrl = new NavController({ - navBar: new NavBar({el: navBarEl }), + ctrl = new ionic.controllers.NavController({ + navBar: new ionic.views.NavBar({el: navBarEl }), content: { el: contentEl }, controllers: [{}] }); diff --git a/hacking/SideMenuController.unit.js b/test/js/controllers/sideMenuController.unit.js similarity index 94% rename from hacking/SideMenuController.unit.js rename to test/js/controllers/sideMenuController.unit.js index d5de171712..7f5b06cdb9 100644 --- a/hacking/SideMenuController.unit.js +++ b/test/js/controllers/sideMenuController.unit.js @@ -27,11 +27,11 @@ describe('SideMenuController', function() { }; beforeEach(function() { - l = new SideMenu({ el: document.createElement('div'), width: 270 }); - r = new SideMenu({ el: document.createElement('div'), width: 270 }); + l = new ionic.views.SideMenu({ el: document.createElement('div'), width: 270 }); + r = new ionic.views.SideMenu({ el: document.createElement('div'), width: 270 }); c = new Controller({ el: document.createElement('div') }); - ctrl = new SideMenuController({ + ctrl = new ionic.controllers.SideMenuController({ left: l, right: r, content: c diff --git a/hacking/TabBarController.unit.js b/test/js/controllers/tabBarController.unit.js similarity index 90% rename from hacking/TabBarController.unit.js rename to test/js/controllers/tabBarController.unit.js index fa1560f601..8a6865d0e1 100644 --- a/hacking/TabBarController.unit.js +++ b/test/js/controllers/tabBarController.unit.js @@ -3,8 +3,8 @@ describe('TabBarController', function() { beforeEach(function() { var tabEl = $('
'); - ctrl = new TabBarController({ - tabBar: new TabBar({ + ctrl = new ionic.controllers.TabBarController({ + tabBar: new ionic.views.TabBar({ el: tabEl.get(0) }) }); @@ -65,8 +65,8 @@ describe('TabBarController', function() { it('Should allow cancelling Controller switch', function() { var tabEl = $(''); - ctrl = new TabBarController({ - tabBar: new TabBar({ el: tabEl.get(0) }), + ctrl = new ionic.controllers.TabBarController({ + tabBar: new ionic.views.TabBar({ el: tabEl.get(0) }), controllerWillChange: function(Controller) { return false; } }); diff --git a/test/js/events.unit.js b/test/js/events.unit.js new file mode 100644 index 0000000000..cf4c5c1d4f --- /dev/null +++ b/test/js/events.unit.js @@ -0,0 +1,6 @@ +describe('Ionic Events', function() { + it('Should block all click events', function() { + var a = document.createElement('a'); + a.click(); + }); +}); diff --git a/hacking/SideMenu.unit.js b/test/js/views/sideMenu.unit.js similarity index 88% rename from hacking/SideMenu.unit.js rename to test/js/views/sideMenu.unit.js index b077bb6d1b..d412770d4a 100644 --- a/hacking/SideMenu.unit.js +++ b/test/js/views/sideMenu.unit.js @@ -3,7 +3,7 @@ describe('SideMenu', function() { beforeEach(function() { var d = document.createElement('div'); - menu = new SideMenu({ + menu = new ionic.views.SideMenu({ el: d, width: 270 }); diff --git a/hacking/TabBar.unit.js b/test/js/views/tabBar.unit.js similarity index 98% rename from hacking/TabBar.unit.js rename to test/js/views/tabBar.unit.js index 89215f3a2d..bde5b23a0a 100644 --- a/hacking/TabBar.unit.js +++ b/test/js/views/tabBar.unit.js @@ -7,7 +7,7 @@ describe('TabBar view', function() { 'Tab 2' + 'Tab 3'); - tabBar = new TabBar({ + tabBar = new ionic.views.TabBar({ el: element.get(0) }); @@ -98,7 +98,7 @@ describe('TabBarItem view', function() { 'Tab 2' + 'Tab 3'); - tabBar = new TabBar({ + tabBar = new ionic.views.TabBar({ el: element.get(0) });