├── packages
└── deft
│ ├── sass
│ ├── etc
│ │ └── all.scss
│ ├── config.rb
│ └── example
│ │ ├── custom.js
│ │ ├── theme.html
│ │ └── fashion.html
│ ├── src
│ ├── js
│ │ └── .gitkeep
│ ├── Readme.md
│ └── coffee
│ │ ├── mvc
│ │ ├── Application.coffee
│ │ ├── ComponentSelectorListener.coffee
│ │ ├── ComponentSelector.coffee
│ │ ├── Observer.coffee
│ │ └── ViewController.coffee
│ │ ├── core
│ │ └── Class.coffee
│ │ ├── util
│ │ ├── DeftMixinUtils.coffee
│ │ └── Function.coffee
│ │ ├── mixin
│ │ ├── Injectable.coffee
│ │ └── Observer.coffee
│ │ ├── event
│ │ ├── LiveEventListener.coffee
│ │ └── LiveEventBus.coffee
│ │ ├── log
│ │ └── Logger.coffee
│ │ ├── promise
│ │ ├── Deferred.coffee
│ │ ├── Chain.coffee
│ │ ├── Consequence.coffee
│ │ └── Resolver.coffee
│ │ └── ioc
│ │ ├── DependencyProvider.coffee
│ │ └── Injector.coffee
│ ├── test
│ ├── js
│ │ └── .gitkeep
│ ├── build.properties
│ ├── lib
│ │ ├── sinon-sencha-1.0.0
│ │ │ └── sinon-sencha.js
│ │ ├── sinon-chai-2.4.0
│ │ │ └── sinon-chai.js
│ │ ├── mocha-1.17.0
│ │ │ └── mocha.css
│ │ ├── mocha-as-promised-2.0.0
│ │ │ └── mocha-as-promised.js
│ │ └── setImmediate-1.0.1
│ │ │ └── setImmediate.js
│ ├── coffee
│ │ ├── custom-assertions.coffee
│ │ ├── log
│ │ │ └── Logger.coffee
│ │ ├── util
│ │ │ └── Function.coffee
│ │ └── mixin
│ │ │ └── Injectable.coffee
│ ├── support
│ │ ├── browser.js
│ │ └── custom-assertions.js
│ ├── build.xml
│ ├── karma
│ │ ├── touch
│ │ │ └── 5.0.0.conf.js
│ │ └── ext
│ │ │ └── 5.0.0.conf.js
│ └── TestRunner.html
│ ├── Readme.md
│ ├── .jsduck
│ ├── theme
│ │ ├── favicon.ico
│ │ └── resources
│ │ │ ├── images
│ │ │ ├── logo.png
│ │ │ ├── tabs.png
│ │ │ └── loading.gif
│ │ │ ├── js
│ │ │ └── theme.js
│ │ │ └── css
│ │ │ └── theme.css
│ └── jsduck.template.json
│ ├── licenses
│ └── Readme.md
│ ├── resources
│ └── Readme.md
│ ├── overrides
│ └── Readme.md
│ ├── build.properties
│ ├── .sencha
│ └── package
│ │ ├── refresh-impl.xml
│ │ ├── build.properties
│ │ ├── testing.properties
│ │ ├── plugin.xml
│ │ ├── resources-impl.xml
│ │ ├── sencha.cfg
│ │ ├── find-cmd-impl.xml
│ │ ├── js-impl.xml
│ │ ├── bootstrap-impl.xml
│ │ ├── codegen.json
│ │ └── defaults.properties
│ ├── jsduck.json
│ ├── package.json
│ └── build.xml
├── .gitignore
├── CONTRIBUTORS.md
├── .sencha
└── workspace
│ ├── plugin.xml
│ └── sencha.cfg
├── package.json
├── LICENSE
├── .travis.yml
└── README.md
/packages/deft/sass/etc/all.scss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/deft/src/js/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/deft/test/js/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/deft/Readme.md:
--------------------------------------------------------------------------------
1 | # deft - Read Me
2 |
3 |
--------------------------------------------------------------------------------
/packages/deft/test/build.properties:
--------------------------------------------------------------------------------
1 | karma.browsers=Chrome,Safari,Firefox
--------------------------------------------------------------------------------
/packages/deft/sass/config.rb:
--------------------------------------------------------------------------------
1 | cur_dir = File.dirname(__FILE__)
2 | output_style = :nested
3 |
--------------------------------------------------------------------------------
/packages/deft/.jsduck/theme/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/deftjs/DeftJS5/HEAD/packages/deft/.jsduck/theme/favicon.ico
--------------------------------------------------------------------------------
/packages/deft/licenses/Readme.md:
--------------------------------------------------------------------------------
1 | # deft/licenses
2 |
3 | This folder contains the supported licenses for third-party use.
4 |
--------------------------------------------------------------------------------
/packages/deft/resources/Readme.md:
--------------------------------------------------------------------------------
1 | # deft/resources
2 |
3 | This folder contains static resources (typically an `"images"` folder as well).
4 |
--------------------------------------------------------------------------------
/packages/deft/overrides/Readme.md:
--------------------------------------------------------------------------------
1 | # deft/overrides
2 |
3 | This folder contains overrides which will automatically be required by package users.
4 |
--------------------------------------------------------------------------------
/packages/deft/.jsduck/theme/resources/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/deftjs/DeftJS5/HEAD/packages/deft/.jsduck/theme/resources/images/logo.png
--------------------------------------------------------------------------------
/packages/deft/.jsduck/theme/resources/images/tabs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/deftjs/DeftJS5/HEAD/packages/deft/.jsduck/theme/resources/images/tabs.png
--------------------------------------------------------------------------------
/packages/deft/.jsduck/theme/resources/images/loading.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/deftjs/DeftJS5/HEAD/packages/deft/.jsduck/theme/resources/images/loading.gif
--------------------------------------------------------------------------------
/packages/deft/src/Readme.md:
--------------------------------------------------------------------------------
1 | # deft/src
2 |
3 | This folder contains source code that will automatically be added to the classpath when
4 | the package is used.
5 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .idea
3 | *.iml
4 | node_modules
5 | build
6 | packages/deft/build
7 | packages/deft/coverage
8 | packages/deft/docs
9 | packages/deft/src/js
10 | packages/deft/test/js
11 |
--------------------------------------------------------------------------------
/packages/deft/build.properties:
--------------------------------------------------------------------------------
1 | deftjs.version=5.0.0
2 | deftjs.copyright.notice=/*!\n\
3 | DeftJS ${deftjs.version}\n\
4 | \n\
5 | Copyright (c) 2012-2015 [DeftJS Framework Contributors](http://deftjs.org)\n\
6 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).\n\
7 | */\n\n
8 |
--------------------------------------------------------------------------------
/CONTRIBUTORS.md:
--------------------------------------------------------------------------------
1 | # Contributors
2 |
3 | * [John Yanarella](http://codecatalyst.com/) (Creator)
4 | * [Brian Kotek](http://www.briankotek.com/)
5 | * [Isaac Johnston](http://superstruct.co/)
6 | * [Ryan Campbell](http://www.ryancampbell.com/)
7 | * [David Tucker](http://www.davidtucker.net/)
8 | * [Rowan Crawford](https://twitter.com/wombleton)
9 |
--------------------------------------------------------------------------------
/packages/deft/.sencha/package/refresh-impl.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/packages/deft/.jsduck/theme/resources/js/theme.js:
--------------------------------------------------------------------------------
1 | Ext.define('Docs.view.CustomViewport', {
2 | override: 'Docs.view.Viewport',
3 |
4 | initComponent: function () {
5 | this.callParent();
6 |
7 | // Resize the north region and header.
8 | var northRegion = Ext.getCmp('north-region');
9 | northRegion.setHeight(80);
10 | northRegion.child('container').setHeight(52);
11 | }
12 | });
--------------------------------------------------------------------------------
/packages/deft/jsduck.json:
--------------------------------------------------------------------------------
1 | {
2 | "--title": "Deft JS - v5.0.0 API Documentation",
3 | "--ignore-global": true,
4 | "--head-html": [
5 | "",
6 | ""
7 | ],
8 | "--output": "docs",
9 | "--": [
10 | "src/js"
11 | ]
12 | }
--------------------------------------------------------------------------------
/packages/deft/.jsduck/jsduck.template.json:
--------------------------------------------------------------------------------
1 | {
2 | "--title": "Deft JS - v${deftjs.version} API Documentation",
3 | "--ignore-global": true,
4 | "--head-html": [
5 | "",
6 | ""
7 | ],
8 | "--output": "docs",
9 | "--": [
10 | "src/js"
11 | ]
12 | }
--------------------------------------------------------------------------------
/packages/deft/.sencha/package/build.properties:
--------------------------------------------------------------------------------
1 | # =============================================================================
2 | # This file provides an override point for default variables defined in
3 | # defaults.properties.
4 | #
5 | # IMPORTANT - Sencha Cmd will merge your changes with its own during upgrades.
6 | # To avoid potential merge conflicts avoid making large, sweeping changes to
7 | # this file.
8 | # =============================================================================
9 |
--------------------------------------------------------------------------------
/packages/deft/sass/example/custom.js:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is generated as a starting point by Sencha Cmd - it will not be replaced or
3 | * updated by "sencha package upgrade".
4 | *
5 | * This file can be removed and the script tag in theme.html removed if this theme does
6 | * not need custom additional manifest or shortcut entries. These are documented in
7 | * ./packages/ext-theme-base/sass/example/render.js.
8 | */
9 |
10 | //Ext.theme.addManifest();
11 |
12 | //Ext.theme.addShortcuts();
13 |
--------------------------------------------------------------------------------
/.sencha/workspace/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/packages/deft/test/lib/sinon-sencha-1.0.0/sinon-sencha.js:
--------------------------------------------------------------------------------
1 | /*
2 | * [sinon-sencha](http://github.com/CodeCatalyst/sinon-sencha) v1.0.0
3 | * Copyright (c) 2013 [CodeCatalyst, LLC](http://www.codecatalyst.com/).
4 | * Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).
5 | */
6 | (function(){
7 | "use strict";
8 |
9 | // Tweak Sinon's "pretty print" logic to make it aware of Sencha classes.
10 | var format = sinon.format;
11 | sinon.format = function (value) {
12 | if (value instanceof Ext.ClassManager.get('Ext.Base')) {
13 | return Ext.ClassManager.getName(value);
14 | }
15 | return format.apply(this, arguments);
16 | }
17 | })();
18 |
--------------------------------------------------------------------------------
/packages/deft/.sencha/package/testing.properties:
--------------------------------------------------------------------------------
1 | # ===========================================
2 | # This file defines properties used by
3 | # build-impl.xml, which is the base impl
4 | # of an applications build process. The
5 | # properties from this file correspond to the
6 | # 'testing' build environment, specified
7 | # by 'sencha app build testing'. These will
8 | # take precedence over defaults provided by
9 | # build.properties.
10 | # ===========================================
11 |
12 | # ===========================================
13 | # compression option used to generate '-all'
14 | # js output file. this value disables
15 | # compression for testing builds
16 | # ===========================================
17 | build.compile.js.compress=
18 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "DeftJS",
3 | "version": "5.0.0",
4 | "author": {
5 | "name": "John Yanarella",
6 | "email": "john.yanarella@deftjs.org"
7 | },
8 | "description": "Essential extensions for large-scale Sencha Touch and Ext JS applications",
9 | "homepage": "http://deftjs.org/",
10 | "repository": {
11 | "type": "git",
12 | "url": "https://github.com/deftjs/DeftJS5.git"
13 | },
14 | "devDependencies": {
15 | "karma": "~0.12.21",
16 | "coffee-script": "1.6.3",
17 | "mocha": "~1.21.4",
18 | "karma-mocha": "~0.1.8",
19 | "karma-coverage": "~0.2.6",
20 | "karma-phantomjs-launcher": "~0.1.4",
21 | "karma-firefox-launcher": "~0.1.3",
22 | "karma-safari-launcher": "~0.1.1"
23 | },
24 | "scripts": {
25 | "test": "cd packages/deft && ant test -Dkarma.browsers=PhantomJS,Firefox"
26 | },
27 | "license": "MIT"
28 | }
29 |
--------------------------------------------------------------------------------
/packages/deft/src/coffee/mvc/Application.coffee:
--------------------------------------------------------------------------------
1 | ###
2 | Copyright (c) 2012-2013 [DeftJS Framework Contributors](http://deftjs.org)
3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).
4 | ###
5 |
6 | ###*
7 | * A lightweight Application template class for use with Ext JS.
8 | ###
9 | Ext.define( 'Deft.mvc.Application',
10 | alternateClassName: [ 'Deft.Application' ]
11 |
12 | ###*
13 | * Indicates whether this Application instance has been initialized.
14 | ###
15 | initialized: false
16 |
17 | ###*
18 | * @param {Object} [config] Configuration object.
19 | ###
20 | constructor: ( config = {} ) ->
21 | @initConfig( config )
22 | Ext.onReady(
23 | ->
24 | @init()
25 | @initialized = true
26 | return
27 | @
28 | )
29 | return @
30 |
31 | ###*
32 | * Initialize the Application
33 | ###
34 | init: ->
35 | return
36 | )
37 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2012 DeftJS Framework Contributors
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/packages/deft/test/coffee/custom-assertions.coffee:
--------------------------------------------------------------------------------
1 | ###
2 | Copyright (c) 2013 [DeftJS Framework Contributors](http://deftjs.org)
3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).
4 | ###
5 |
6 | describe( 'Custom Assertions', ->
7 |
8 | specify( 'memberOf', ->
9 | expect( 1 ).to.be.a.memberOf( [ 1, 2, 3 ] )
10 | expect( 0 ).not.to.be.a.memberOf( [ 1, 2, 3 ] )
11 | return
12 | )
13 |
14 | specify( 'membersOf', ->
15 | expect( [ 1 ] ).to.be.membersOf( [ 1, 2, 3 ] )
16 | expect( [ 1, 2 ] ).to.be.membersOf( [ 1, 2, 3 ] )
17 | expect( [ 0 ] ).not.to.be.membersOf( [ 1, 2, 3 ] )
18 | expect( [ 0, 5 ] ).not.to.be.membersOf( [ 1, 2, 3 ] )
19 | return
20 | )
21 |
22 | specify( 'unique', ->
23 | expect( [ 1, 2, 3 ] ).to.be.unique
24 | expect( [ 1, 2, 1 ] ).not.to.be.unique
25 | return
26 | )
27 |
28 | specify( 'eventuallyThrow', ( done ) ->
29 | @slow( 250 )
30 | setTimeout(
31 | ->
32 | throw new Error( 'error message' )
33 | 0
34 | )
35 | assert.eventuallyThrows( new Error( 'error message' ), done, 100 )
36 | return
37 | )
38 |
39 | return
40 | )
--------------------------------------------------------------------------------
/packages/deft/src/coffee/mvc/ComponentSelectorListener.coffee:
--------------------------------------------------------------------------------
1 | ###
2 | Copyright (c) 2012-2013 [DeftJS Framework Contributors](http://deftjs.org)
3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).
4 | ###
5 |
6 | ###*
7 | * Manages live events attached to component selectors. Used by Deft.mvc.ComponentSelector.
8 | * @private
9 | ###
10 | Ext.define( 'Deft.mvc.ComponentSelectorListener',
11 | requires: [
12 | 'Deft.event.LiveEventBus'
13 | ]
14 |
15 | constructor: ( config ) ->
16 | Ext.apply( @, config )
17 |
18 | if @componentSelector.live
19 | Deft.LiveEventBus.addListener( @componentSelector.view, @componentSelector.selector, @eventName, @fn, @scope, @options )
20 | else
21 | for component in @componentSelector.components
22 | component.on( @eventName, @fn, @scope, @options )
23 | return @
24 |
25 | destroy: ->
26 | if @componentSelector.live
27 | Deft.LiveEventBus.removeListener( @componentSelector.view, @componentSelector.selector, @eventName, @fn, @scope )
28 | else
29 | for component in @componentSelector.components
30 | component.un( @eventName, @fn, @scope )
31 | return
32 | )
--------------------------------------------------------------------------------
/packages/deft/test/support/browser.js:
--------------------------------------------------------------------------------
1 | mocha.setup({
2 | ui: "bdd"
3 | });
4 |
5 | chai.should();
6 |
7 | window.assert = chai.assert;
8 | window.expect = chai.expect;
9 |
10 | // Required for Phantom JS until 2.0 is released - it lacks Function.prototype.bind.
11 | // Adaoted fron Modernizr - https://github.com/Modernizr/Modernizr/blob/master/src/fnBind.js
12 | if (!Function.prototype.bind) {
13 | var slice = [].slice;
14 | Function.prototype.bind = function bind(that) {
15 | var target = this;
16 | if (typeof target != 'function') {
17 | throw new TypeError();
18 | }
19 | var args = slice.call(arguments, 1);
20 | var bound = function() {
21 | if (this instanceof bound) {
22 | var F = function(){};
23 | F.prototype = target.prototype;
24 | var self = new F();
25 | var result = target.apply(
26 | self,
27 | args.concat(slice.call(arguments))
28 | );
29 | if (Object(result) === result) {
30 | return result;
31 | }
32 | return self;
33 | } else {
34 | return target.apply(
35 | that,
36 | args.concat(slice.call(arguments))
37 | );
38 | }
39 | };
40 | return bound;
41 | };
42 | }
--------------------------------------------------------------------------------
/packages/deft/sass/example/theme.html:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 | Ext JS Theme Harness
8 |
9 |
10 |
11 |
14 |
15 |
16 |
17 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/packages/deft/src/coffee/core/Class.coffee:
--------------------------------------------------------------------------------
1 | ###
2 | Copyright (c) 2012-2013 [DeftJS Framework Contributors](http://deftjs.org)
3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).
4 | ###
5 |
6 | ###*
7 | * A collection of useful static methods for interacting with (and normalizing differences between) the Sencha Touch and Ext JS class systems.
8 | * @private
9 | ###
10 | Ext.define( 'Deft.core.Class',
11 | alternateClassName: [ 'Deft.Class' ]
12 |
13 | statics:
14 |
15 | ###*
16 | * Determines whether the passed Class reference is or extends the specified Class (by name).
17 | *
18 | * @return {Boolean} A Boolean indicating whether the specified Class reference is or extends the specified Class (by name)
19 | ###
20 | extendsClass: ( targetClass, className ) ->
21 | try
22 | return true if Ext.getClassName( targetClass ) is className
23 | if targetClass?.superclass
24 | if Ext.getClassName( targetClass.superclass ) is className
25 | return true
26 | else
27 | return Deft.Class.extendsClass( Ext.getClass( targetClass.superclass ), className )
28 | else return false
29 | catch error
30 | return false
31 | )
32 |
--------------------------------------------------------------------------------
/packages/deft/src/coffee/util/DeftMixinUtils.coffee:
--------------------------------------------------------------------------------
1 | ###*
2 | * Utility class to support Deft JS mixins.
3 | ###
4 | Ext.define( "Deft.util.DeftMixinUtils",
5 |
6 | statics:
7 |
8 | ###*
9 | * Uses the passed mergeFn to recursively merge the specified propertyName up the class hierarchy of the target.
10 | ###
11 | mergeSuperclassProperty: ( target, propertyName, mergeFn=Ext.merge, currentResult=null ) ->
12 | wasMerged = false
13 | isRecursionStart = false
14 |
15 | if( !currentResult? )
16 | currentResult = {}
17 | isRecursionStart = true
18 |
19 | if( target?.superclass? )
20 | currentResult = @mergeSuperclassProperty( target.superclass, propertyName, mergeFn, currentResult )
21 |
22 | if( target?[ propertyName ]? )
23 | currentResult = mergeFn( currentResult, target[ propertyName ], Ext.getClassName( target ) )
24 | wasMerged = true
25 |
26 | if( wasMerged and isRecursionStart )
27 | target[ propertyName ] = Ext.clone( currentResult )
28 |
29 | return currentResult
30 |
31 |
32 | ###*
33 | * Returns the proper method name to call the superclass constructor, based on platform and version.
34 | ###
35 | parentConstructorForVersion: ->
36 | return "callParent"
37 |
38 |
39 | )
40 |
41 |
--------------------------------------------------------------------------------
/packages/deft/package.json:
--------------------------------------------------------------------------------
1 | {
2 | /**
3 | * The namespace of this package.
4 | *
5 | * As a general rule, all classes that belong to this package should be under this namespace
6 | * if multiple namespaces are part of this package, set this to "".
7 | */
8 | "namespace": "deft",
9 |
10 |
11 | "name": "deft",
12 | "type": "code",
13 | "creator": "Deft JS",
14 | "summary": "Extensions for Large-Scale Sencha Touch and Ext JS 6 Applications",
15 | "detailedDescription": "Deft JS extends Sencha Touch and Ext JS to add an Inversion of Control (IoC) container, for dependency injection and dynamic application assembly; and a Promises/A+ compliant implementation of Promises and Deferreds, for simplified coordination, aggregation and transformation of asynchronous operations and their resulting values.",
16 | "version": "6.0.0",
17 | "compatVersion": "6.0.0",
18 | "format": "1",
19 | "toolkit": "classic",
20 | "slicer": {
21 | "js": [
22 | {
23 | "path": "${package.dir}/sass/example/custom.js",
24 | "isWidgetManifest": true
25 | }
26 | ]
27 | },
28 | "output": "${package.dir}/build",
29 | "local": true,
30 | "requires": []
31 | }
32 |
--------------------------------------------------------------------------------
/packages/deft/sass/example/fashion.html:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 | Ext JS Theme Harness
8 |
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/packages/deft/src/coffee/mixin/Injectable.coffee:
--------------------------------------------------------------------------------
1 | ###
2 | Copyright (c) 2012-2013 [DeftJS Framework Contributors](http://deftjs.org)
3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).
4 | ###
5 |
6 | ###*
7 | * A mixin that marks a class as participating in dependency injection. Used in conjunction with Deft.ioc.Injector.
8 | ###
9 | Ext.define( 'Deft.mixin.Injectable',
10 | extend: 'Ext.Mixin'
11 |
12 | requires: [
13 | 'Deft.core.Class'
14 | 'Deft.ioc.Injector'
15 | 'Deft.log.Logger'
16 | ]
17 |
18 | mixinConfig:
19 | before:
20 | constructor: 'onCreate'
21 |
22 | isInjectable: true
23 | mixinId: 'injectable'
24 |
25 | onCreate: () ->
26 |
27 | objectifyInject = ( Class ) ->
28 |
29 | unless Class
30 | return {}
31 | injectBase = objectifyInject( Class.superclass )
32 | else
33 | injectBase = {}
34 |
35 | inject = Class.inject || {}
36 |
37 | # Convert String/Array to Object for injection
38 | inject = [ inject ] if Ext.isString( inject )
39 | if Ext.isArray( inject )
40 | injectObject = {}
41 | for id in inject
42 | injectObject[ id ] = id
43 | inject = injectObject
44 |
45 | Ext.applyIf( inject, objectifyInject( Class.superclass ) )
46 |
47 | @inject = objectifyInject( @ )
48 |
49 | unless @$injected
50 | Deft.Injector.inject( @inject, @, arguments, false )
51 | @$injected = true
52 |
53 | )
54 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - 0.10.30
4 | env:
5 | - DEFT_SENCHA_EXT_VERSION="6.0.0" DEFT_SENCHA_CMD_VERSION="6.0.1.76"
6 | before_script:
7 | # Framebuffer for Firefox
8 | - "export DISPLAY=:99.0"
9 | - "sh -e /etc/init.d/xvfb start"
10 | # Install JSDuck dependency
11 | - "gem install jsduck"
12 | # Download, unzip and symlink Sencha Ext JS dependency
13 | - "wget http://cdn.sencha.com/ext/gpl/ext-$DEFT_SENCHA_EXT_VERSION-gpl.zip"
14 | - "unzip -q ext-$DEFT_SENCHA_EXT_VERSION-gpl.zip"
15 | - "ln -sv `pwd`/ext-$DEFT_SENCHA_EXT_VERSION $TRAVIS_BUILD_DIR/../ext"
16 | # Install Sencha Cmd
17 | - "wget http://cdn.sencha.com/cmd/$DEFT_SENCHA_CMD_VERSION/no-jre/SenchaCmd-$DEFT_SENCHA_CMD_VERSION-linux-amd64.sh.zip"
18 | - "unzip -q SenchaCmd-$DEFT_SENCHA_CMD_VERSION-linux-amd64.sh.zip"
19 | - "chmod +x SenchaCmd-$DEFT_SENCHA_CMD_VERSION-linux-amd64.sh"
20 | - "./SenchaCmd-$DEFT_SENCHA_CMD_VERSION-linux-amd64.sh -q"
21 | # Make Sencha Cmd and CoffeeScript available in the PATH
22 | - "export PATH=~/bin/Sencha/Cmd/$DEFT_SENCHA_CMD_VERSION/:$TRAVIS_BUILD_DIR/node_modules/karma/bin:$TRAVIS_BUILD_DIR/node_modules/coffee-script/bin:$PATH"
23 | # Change directory to the package and build the package
24 | - "cd $TRAVIS_BUILD_DIR/packages/deft && sencha package build"
25 | # Change directory back to the root of the repository ready for running tests
26 | - "cd $TRAVIS_BUILD_DIR"
27 |
--------------------------------------------------------------------------------
/packages/deft/.sencha/package/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
22 |
23 |
24 |
32 |
33 |
--------------------------------------------------------------------------------
/packages/deft/test/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/packages/deft/test/support/custom-assertions.js:
--------------------------------------------------------------------------------
1 | chai.use(function(chai, utils) {
2 | var assert = chai.assert;
3 | var expect = chai.expect;
4 | var Assertion = chai.Assertion;
5 |
6 | Assertion.addMethod('memberOf', function(array) {
7 | var value = utils.flag(this, 'object');
8 | this.assert(Ext.Array.contains(array, value), 'expected #{this} to be a member of ' + utils.inspect(array), 'expected #{this} to not be a member of ' + +utils.inspect(array));
9 | });
10 |
11 | Assertion.addMethod('membersOf', function(array) {
12 | var values = utils.flag(this, 'object');
13 | expect(values).to.be.an.Array;
14 | this.assert(Ext.Array.filter(values, function(value) {
15 | return !Ext.Array.contains(array, value);
16 | }).length === 0, 'expected #{this} to be members of ' + utils.inspect(array), 'expected #{this} to not be members of ' + +utils.inspect(array));
17 | });
18 |
19 | Assertion.addProperty('unique', function() {
20 | var values = utils.flag(this, 'object');
21 | expect(values).to.be.an.instanceOf(Array);
22 | this.assert(Ext.Array.unique(values).length === values.length, 'expected #{this} to be comprised of unique values', 'expected #{this} not to be comprised of unique values');
23 | });
24 |
25 | assert.eventuallyThrows = function(error, done, timeout) {
26 | if (timeout == null) {
27 | timeout = 50;
28 | }
29 | var originalHandler = window.onerror;
30 | var restored = false;
31 | window.onerror = function(message) {
32 | window.onerror = originalHandler;
33 | restored = true;
34 | expect(message).to.contain(error.message);
35 | done();
36 | };
37 | setTimeout(function() {
38 | if (!restored) {
39 | window.onerror = originalHandler;
40 | return done(new Error('expected ' + error + ' to be thrown within ' + timeout + 'ms'));
41 | }
42 | }, timeout);
43 | };
44 | });
45 |
--------------------------------------------------------------------------------
/packages/deft/.jsduck/theme/resources/css/theme.css:
--------------------------------------------------------------------------------
1 | #loading .logo {
2 | background: url(../images/loading.gif) no-repeat center;
3 | background-size: 64px 64px;
4 | }
5 |
6 | #north-region {
7 | background: #4e4e4e; /* Old browsers */
8 | background: -moz-linear-gradient(top, #4e4e4e 0%, #3e3e3e 100%); /* FF3.6+ */
9 | background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#4e4e4e), color-stop(100%,#3e3e3e)); /* Chrome,Safari4+ */
10 | background: -webkit-linear-gradient(top, #4e4e4e 0%,#3e3e3e 100%); /* Chrome10+,Safari5.1+ */
11 | background: -o-linear-gradient(top, #4e4e4e 0%,#3e3e3e 100%); /* Opera 11.10+ */
12 | background: -ms-linear-gradient(top, #4e4e4e 0%,#3e3e3e 100%); /* IE10+ */
13 | background: linear-gradient(to bottom, #4e4e4e 0%,#3e3e3e 100%); /* W3C */
14 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4e4e4e', endColorstr='#3e3e3e',GradientType=0 ); /* IE6-9 */
15 | }
16 |
17 | #north-region .dropdown {
18 | background-position: center right;
19 | }
20 |
21 | #north-region #header-content {
22 | height: 42px;
23 | background: url(../images/logo.png) 0 0 no-repeat;
24 | background-size: 32px 32px;
25 | padding-top: 8px;
26 | padding-left: 38px;
27 | font-size: 16px;
28 | }
29 |
30 | #search-container {
31 | margin: 12px 0 0 0 !important;
32 | }
33 |
34 | .doctab.overview.classes {
35 | margin-right: 182px;
36 | }
37 |
38 | .doctabs .doctab .l {
39 | background: url(../images/tabs.png) no-repeat -8px -141px;
40 | }
41 | .doctabs .doctab .m {
42 | background: url(../images/tabs.png) repeat-x 0 -173px;
43 | }
44 | .doctabs .doctab .r {
45 | background: url(../images/tabs.png) no-repeat 0 -239px;
46 | }
47 |
48 | #center-container h1, #center-container h1 .class-source-link {
49 | color: #222222;
50 | }
51 |
52 | .class-overview .new-keyword {
53 | color: #3c84c5;
54 | }
55 |
56 | a:link, a:visited {
57 | color: #3c84c5;
58 | }
--------------------------------------------------------------------------------
/packages/deft/src/coffee/event/LiveEventListener.coffee:
--------------------------------------------------------------------------------
1 | ###
2 | Copyright (c) 2012-2013 [DeftJS Framework Contributors](http://deftjs.org)
3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).
4 | ###
5 |
6 | ###*
7 | * Event listener for events fired via the Deft.event.LiveEventBus.
8 | * @private
9 | ###
10 | Ext.define( 'Deft.event.LiveEventListener',
11 | alternateClassName: [ 'Deft.LiveEventListener' ]
12 | requires: [
13 | 'Ext.ComponentQuery'
14 | ]
15 |
16 | constructor: ( config ) ->
17 | Ext.apply( @, config )
18 |
19 | @components = []
20 | components = Ext.ComponentQuery.query( @selector, @container )
21 | for component in components
22 | @components.push( component )
23 | component.on( @eventName, @fn, @scope, @options )
24 | return
25 |
26 | destroy: ->
27 | for component in @components
28 | component.un( @eventName, @fn, @scope )
29 | @components = null
30 | return
31 |
32 | # Register a candidate component as a source of 'live' events (typically called when a component is added to a container).
33 | register: ( component ) ->
34 | if @matches( component )
35 | @components.push( component )
36 | component.on( @eventName, @fn, @scope, @options )
37 | return
38 |
39 | # Unregister a candidate component as a source of 'live' events (typically called when a component is removed from a container).
40 | unregister: ( component ) ->
41 | index = Ext.Array.indexOf( @components, component )
42 | if index isnt -1
43 | component.un( @eventName, @fn, @scope )
44 | Ext.Array.erase( @components, index, 1 )
45 | return
46 |
47 | # @private
48 | matches: ( component ) ->
49 | if @selector is null and @container is component
50 | return true
51 | if @container is null and Ext.Array.contains( Ext.ComponentQuery.query( @selector ), component )
52 | return true
53 | if component.isDescendantOf( @container ) and Ext.Array.contains( @container.query( @selector ), component )
54 | return true
55 | return false
56 | )
--------------------------------------------------------------------------------
/.sencha/workspace/sencha.cfg:
--------------------------------------------------------------------------------
1 | #Mon, 17 Jun 2013 21:55:08 +1200
2 | # -----------------------------------------------------------------------------
3 | # This file contains configuration options that apply to all applications in
4 | # the workspace. By convention, these options start with "workspace." but any
5 | # option can be set here. Options specified in an application's sencha.cfg will
6 | # take priority over those values contained in this file. These options will
7 | # take priority over configuration values in Sencha Cmd or a framework plugin.
8 |
9 | # -----------------------------------------------------------------------------
10 | # This configuration property (if set) is included by default in all compile
11 | # commands executed according to this formulation:
12 | #
13 | # sencha compile -classpath=...,${framework.classpath},${workspace.classpath},${app.classpath}
14 |
15 | #workspace.classpath=
16 |
17 | #------------------------------------------------------------------------------
18 | # This is the folder for build outputs in the workspace
19 |
20 | workspace.build.dir=${workspace.dir}/build
21 |
22 | #------------------------------------------------------------------------------
23 | # This folder contains all generated and extracted packages.
24 |
25 | workspace.packages.dir=${workspace.dir}/packages
26 |
27 | workspace.theme.dir=${workspace.packages.dir}/${args.themeName}
28 |
29 | # =============================================================================
30 | # Customizations go below this divider to avoid merge conflicts on upgrade
31 | # =============================================================================
32 |
33 | workspace.cmd.version=6.0.1.76
34 |
35 | #------------------------------------------------------------------------------
36 | # This folder should contain a copy of Sencha ExtJS
37 |
38 | ext.dir=${workspace.dir}/../ext
39 |
40 | #------------------------------------------------------------------------------
41 | # This folder should contain a copy of Sencha Touch
42 |
43 | touch.dir=${workspace.dir}/../touch
44 |
--------------------------------------------------------------------------------
/packages/deft/.sencha/package/resources-impl.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Merging resources from base package ${base.path}
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Merging resources from current package ${package.resources.dir}
28 |
29 |
30 |
31 |
32 |
33 |
34 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/packages/deft/src/coffee/log/Logger.coffee:
--------------------------------------------------------------------------------
1 | ###
2 | Copyright (c) 2012-2013 [DeftJS Framework Contributors](http://deftjs.org)
3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).
4 | ###
5 |
6 | ###*
7 | * Logger used by DeftJS.
8 | *
9 | * Output is displayed in the console when using `ext-dev`/`ext-all-dev` or `sencha-debug`/`sencha-all-debug`.
10 | *
11 | * @private
12 | ###
13 | Ext.define( 'Deft.log.Logger',
14 | alternateClassName: [ 'Deft.Logger' ]
15 | requires: [
16 | 'Deft.util.Function'
17 | ]
18 | singleton: true
19 |
20 | ###*
21 | * Logs a message with the specified priority.
22 | *
23 | * @param {String} message The message to log.
24 | * @param {String} priority The priority of the log message. Valid values are: `verbose`, `info`, `deprecate`, `warn` and `error`.
25 | ###
26 | log: ( message, priority = 'info' ) ->
27 | # NOTE: Stubbed implementation, replaced in class creation callback below.
28 | return
29 |
30 | ###*
31 | * Logs a message with 'verbose' priority.
32 | *
33 | * @param {String} message The message to log.
34 | ###
35 | verbose: ( message ) ->
36 | @log( message, 'verbose' )
37 | return
38 |
39 | ###*
40 | * Logs a message with 'info' priority.
41 | *
42 | * @param {String} message The message to log.
43 | ###
44 | info: ( message ) ->
45 | @log( message, 'info' )
46 | return
47 |
48 | ###*
49 | * Logs a message with 'deprecate' priority.
50 | *
51 | * @param {String} message The message to log.
52 | ###
53 | deprecate: ( message ) ->
54 | @log( message, 'deprecate' )
55 | return
56 |
57 | ###*
58 | * Logs a message with 'warn' priority.
59 | *
60 | * @param {String} message The message to log.
61 | ###
62 | warn: ( message ) ->
63 | @log( message, 'warn' )
64 | return
65 |
66 | ###*
67 | * Logs a message with 'error' priority.
68 | *
69 | * @param {String} message The message to log.
70 | ###
71 | error: ( message ) ->
72 | @log( message, 'error' )
73 | return
74 | ,
75 | ->
76 | @log = ( message, priority = 'info' ) ->
77 | if priority is 'verbose'
78 | priority = 'info'
79 | if priority is 'deprecate'
80 | priority = 'warn'
81 |
82 | Ext.Logger.log( message, priority )
83 | return
84 | )
85 |
--------------------------------------------------------------------------------
/packages/deft/.sencha/package/sencha.cfg:
--------------------------------------------------------------------------------
1 | # The name of the package - should match the "name" property in ./package.json
2 | #
3 | package.name=deft
4 |
5 | # The namespace to which this package's SASS corresponds. The default value of
6 | # "Ext" means that the files in ./sass/src (and ./sass/var) match classes in
7 | # the Ext" root namespace. In other words, "Ext.panel.Panel" maps to
8 | # ./sass/src/panel/Panel.scss.
9 | #
10 | # To style classes from any namespace, set this to blank. If this is blank,
11 | # then to style "Ext.panel.Panel" you would put SASS in
12 | # ./sass/src/Ext/panel/Panel.scss.
13 | #
14 | package.sass.namespace=Ext
15 |
16 | # This is the comma-separated list of folders where classes reside. These
17 | # classes must be explicitly required to be included in the build.
18 | #
19 | package.classpath=${package.dir}/src
20 |
21 | # This is the comma-separated list of folders of overrides. All files in this
22 | # path will be given a tag of "packageOverrides" which is automatically
23 | # required in generated apps by the presence of this line in app.js:
24 | #
25 | # //@require @packageOverrides
26 | #
27 | package.overrides=${package.dir}/overrides
28 |
29 | # This is the folder where SASS "src" resides. This is searched for SCSS
30 | # files that match the JavaScript classes used by the application.
31 | #
32 | package.sass.srcpath=${package.dir}/sass/src
33 |
34 | # This is the folder where SASS "vars" resides. This is searched for SCSS
35 | # files that match the JavaScript classes used by the application.
36 | #
37 | package.sass.varpath=${package.dir}/sass/var
38 |
39 | # This file is automatically imported into the SASS build before "vars".
40 | #
41 | package.sass.etcpath=${package.dir}/sass/etc/all.scss
42 |
43 | # This is the folder in which to place "sencha packaage build" output.
44 | #
45 | package.build.dir=${package.dir}/build
46 |
47 | # The folder that contains example application(s) for this package.
48 | #
49 | package.examples.dir=${package.dir}/examples
50 |
51 | # The folder that contains sub-packages of this package. Only valid for "framework"
52 | # package type.
53 | #
54 | package.subpkgs.dir=${package.dir}/packages
55 |
56 | #==============================================================================
57 | # Custom Properties - Place customizations below this line to avoid merge
58 | # conflicts with newer versions
59 |
60 | package.cmd.version=6.0.1.76
61 |
62 | # Automatically include ExtJS in the classpath
63 | #
64 | package.framework=ext
65 |
--------------------------------------------------------------------------------
/packages/deft/.sencha/package/find-cmd-impl.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
27 |
28 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
50 |
51 |
52 | source ~/.bash_profile; sencha which -p cmd.dir -o '$cmddir$'
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/packages/deft/.sencha/package/js-impl.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
16 |
17 |
18 |
19 |
20 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
45 |
46 |
47 |
48 |
49 |
50 |
63 |
64 |
65 |
66 |
67 |
68 |
70 |
71 |
--------------------------------------------------------------------------------
/packages/deft/test/karma/touch/5.0.0.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration
2 | // Generated on Mon Jan 20 2014 05:41:33 GMT-0500 (EST)
3 |
4 | module.exports = function(config) {
5 | config.set({
6 |
7 | // base path, that will be used to resolve files and exclude
8 | basePath: '../../..',
9 |
10 |
11 | // frameworks to use
12 | frameworks: ['mocha'],
13 |
14 |
15 | // list of files / patterns to load in the browser
16 | files: [
17 | '../../../touch/builds/sencha-touch-all-compat.js',
18 | 'build/deft-debug.js',
19 |
20 | 'test/lib/chai-1.8.1/chai.js',
21 | 'test/lib/sinon-1.7.3/sinon.js',
22 | 'test/lib/sinon-chai-2.4.0/sinon-chai.js',
23 | 'test/lib/sinon-sencha-1.0.0/sinon-sencha.js',
24 |
25 | 'test/support/browser.js',
26 | 'test/support/custom-assertions.js',
27 |
28 | 'test/lib/mocha-as-promised-2.0.0/mocha-as-promised.js',
29 | 'test/lib/chai-as-promised-4.1.0/chai-as-promised.js',
30 |
31 | 'test/js/custom-assertions.js',
32 |
33 | 'test/js/util/Function.js',
34 | 'test/js/log/Logger.js',
35 | 'test/js/ioc/Injector.js',
36 | 'test/js/mixin/Injectable.js',
37 | 'test/lib/promises-aplus-tests-2.0.3/promises-aplus-tests.js',
38 | 'test/js/promise/Promise.js',
39 | 'test/js/promise/Chain.js'
40 | ],
41 |
42 |
43 | // list of files to exclude
44 | exclude: [
45 | ],
46 |
47 | preprocessors: {
48 | 'build/deft-debug.js': ['coverage']
49 | },
50 |
51 | coverageReporter: {
52 | type: 'html',
53 | dir: 'test/coverage/touch/5.0.0'
54 | },
55 |
56 | // test results reporter to use
57 | // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
58 | reporters: ['dots'],
59 |
60 |
61 | // web server port
62 | port: 9876,
63 |
64 |
65 | // enable / disable colors in the output (reporters and logs)
66 | colors: true,
67 |
68 |
69 | // level of logging
70 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
71 | logLevel: config.LOG_INFO,
72 |
73 |
74 | // enable / disable watching file and executing tests whenever any file changes
75 | autoWatch: true,
76 |
77 |
78 | // Start these browsers, currently available:
79 | // - Chrome
80 | // - ChromeCanary
81 | // - Firefox
82 | // - Opera (has to be installed with `npm install karma-opera-launcher`)
83 | // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
84 | // - PhantomJS
85 | // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
86 | browsers: ['Chrome'],
87 |
88 |
89 | // If browser does not capture in given timeout [ms], kill it
90 | captureTimeout: 60000,
91 |
92 |
93 | // Continuous Integration mode
94 | // if true, it capture browsers, run tests and exit
95 | singleRun: false
96 | });
97 | };
98 |
--------------------------------------------------------------------------------
/packages/deft/test/karma/ext/5.0.0.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration
2 | // Generated on Mon Jan 20 2014 05:41:33 GMT-0500 (EST)
3 |
4 | module.exports = function(config) {
5 | config.set({
6 |
7 | // base path, that will be used to resolve files and exclude
8 | basePath: '../../..',
9 |
10 |
11 | // frameworks to use
12 | frameworks: ['mocha'],
13 |
14 |
15 | // list of files / patterns to load in the browser
16 | files: [
17 | 'http://cdn.sencha.io/ext/gpl/5.1.0/build/ext-all.js',,
18 | 'build/deft-debug.js',
19 |
20 | 'test/lib/chai-1.8.1/chai.js',
21 | 'test/lib/sinon-1.7.3/sinon.js',
22 | 'test/lib/sinon-chai-2.4.0/sinon-chai.js',
23 | 'test/lib/sinon-sencha-1.0.0/sinon-sencha.js',
24 |
25 | 'test/support/browser.js',
26 | 'test/support/custom-assertions.js',
27 |
28 | 'test/lib/mocha-as-promised-2.0.0/mocha-as-promised.js',
29 | 'test/lib/chai-as-promised-4.1.0/chai-as-promised.js',
30 |
31 | 'test/js/custom-assertions.js',
32 |
33 | 'test/js/util/Function.js',
34 | 'test/js/log/Logger.js',
35 | 'test/js/ioc/Injector.js',
36 | 'test/js/mixin/Injectable.js',
37 | 'test/js/mvc/ViewController.js',
38 | 'test/lib/promises-aplus-tests-2.0.3/promises-aplus-tests.js',
39 | 'test/js/promise/Promise.js',
40 | 'test/js/promise/Chain.js'
41 | ],
42 |
43 |
44 | // list of files to exclude
45 | exclude: [
46 | ],
47 |
48 | preprocessors: {
49 | 'build/deft-debug.js': ['coverage']
50 | },
51 |
52 | coverageReporter: {
53 | type: 'html',
54 | dir: 'test/coverage/ext/5.1.0'
55 | },
56 |
57 | // test results reporter to use
58 | // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
59 | reporters: ['dots'],
60 |
61 |
62 | // web server port
63 | port: 9876,
64 |
65 |
66 | // enable / disable colors in the output (reporters and logs)
67 | colors: true,
68 |
69 |
70 | // level of logging
71 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
72 | logLevel: config.LOG_INFO,
73 |
74 |
75 | // enable / disable watching file and executing tests whenever any file changes
76 | autoWatch: true,
77 |
78 |
79 | // Start these browsers, currently available:
80 | // - Chrome
81 | // - ChromeCanary
82 | // - Firefox
83 | // - Opera (has to be installed with `npm install karma-opera-launcher`)
84 | // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
85 | // - PhantomJS
86 | // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
87 | browsers: ['Chrome'],
88 |
89 |
90 | // If browser does not capture in given timeout [ms], kill it
91 | captureTimeout: 60000,
92 |
93 |
94 | // Continuous Integration mode
95 | // if true, it capture browsers, run tests and exit
96 | singleRun: false
97 | });
98 | };
99 |
--------------------------------------------------------------------------------
/packages/deft/src/coffee/mvc/ComponentSelector.coffee:
--------------------------------------------------------------------------------
1 | ###
2 | Copyright (c) 2012-2013 [DeftJS Framework Contributors](http://deftjs.org)
3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).
4 | ###
5 |
6 | ###*
7 | * @private
8 | * Models a component selector used by Deft.mvc.ViewController to locate view components and attach event listeners.
9 | ###
10 | Ext.define( 'Deft.mvc.ComponentSelector',
11 | requires: [
12 | 'Ext.ComponentQuery'
13 | 'Deft.log.Logger'
14 | 'Deft.mvc.ComponentSelectorListener'
15 | 'Deft.util.Function'
16 | ]
17 |
18 | constructor: ( config ) ->
19 | Ext.apply( @, config )
20 |
21 | if not @live
22 | @components = if @selector? then Ext.ComponentQuery.query( @selector, @view ) else [ @view ]
23 |
24 | @selectorListeners = []
25 |
26 | if Ext.isObject( @listeners )
27 | for eventName, listener of @listeners
28 | fn = listener
29 | scope = @scope
30 | options = null
31 |
32 | # Parse `options` if present.
33 | if Ext.isObject( listener )
34 | options = Ext.apply( {}, listener )
35 | if options.fn?
36 | fn = options.fn
37 | delete options.fn
38 | if options.scope?
39 | scope = options.scope
40 | delete options.scope
41 |
42 | # Parse `fn`.
43 | if Ext.isString( fn ) and Deft.isFunction( scope[ fn ] )
44 | fn = scope[ fn ]
45 | if not Deft.isFunction ( fn )
46 | Ext.Error.raise( msg: "Error adding '#{ eventName }' listener: the specified handler '#{ fn }' is not a Function or does not exist." )
47 |
48 | @addListener( eventName, fn, scope, options )
49 | return @
50 |
51 | destroy: ->
52 | for selectorListener in @selectorListeners
53 | selectorListener.destroy()
54 | @selectorListeners = []
55 | return
56 |
57 | ###*
58 | Add an event listener to this component selector.
59 | ###
60 | addListener: ( eventName, fn, scope, options ) ->
61 | if @findListener( eventName, fn, scope )?
62 | Ext.Error.raise( msg: "Error adding '#{ eventName }' listener: an existing listener for the specified function was already registered for '#{ @selector }." )
63 |
64 | Deft.Logger.log( "Adding '#{ eventName }' listener to '#{ @selector }'." )
65 | selectorListener = Ext.create( 'Deft.mvc.ComponentSelectorListener',
66 | componentSelector: @
67 | eventName: eventName
68 | fn: fn
69 | scope: scope
70 | options: options
71 | )
72 | @selectorListeners.push( selectorListener )
73 | return
74 |
75 | ###*
76 | Remove an event listener from this component selector.
77 | ###
78 | removeListener: ( eventName, fn, scope ) ->
79 | selectorListener = @findListener( eventName, fn, scope )
80 | if selectorListener?
81 | Deft.Logger.log( "Removing '#{ eventName }' listener from '#{ @selector }'." )
82 | selectorListener.destroy()
83 | Ext.Array.remove( @selectorListeners, selectorListener )
84 | return
85 |
86 | # @private
87 | findListener: ( eventName, fn, scope ) ->
88 | for selectorListener in @selectorListeners
89 | if selectorListener.eventName is eventName and selectorListener.fn is fn and selectorListener.scope is scope
90 | return selectorListener
91 | return null
92 | )
--------------------------------------------------------------------------------
/packages/deft/src/coffee/util/Function.coffee:
--------------------------------------------------------------------------------
1 | ###
2 | Copyright (c) 2012-2014 [DeftJS Framework Contributors](http://deftjs.org)
3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).
4 | ###
5 |
6 | ###*
7 | * A collection of useful static methods for interacting with Functions.
8 | ###
9 | Ext.define( 'Deft.util.Function',
10 | alternateClassName: [ 'Deft.Function' ]
11 |
12 | statics:
13 | ###*
14 | * Returns a new wrapper function that caches the return value for previously processed function argument(s).
15 | *
16 | * @param {Function} fn Function to wrap.
17 | * @param {Object} scope Optional scope in which to execute the wrapped function.
18 | * @param {Function} hashFn Optional function used to compute a hash key for storing the result, based on the arguments to the original function.
19 | * @return {Function} The new wrapper function.
20 | ###
21 | memoize: ( fn, scope, hashFn ) ->
22 | memo = {}
23 | return ( value ) ->
24 | key = if Deft.isFunction( hashFn ) then hashFn.apply( scope, arguments ) else value
25 | memo[ key ] = fn.apply( scope, arguments ) unless key of memo
26 | return memo[ key ]
27 |
28 | ###*
29 | * @method
30 | * Schedules the specified callback function to be executed on the next turn of the event loop.
31 | *
32 | * @param {Function} fn Callback function.
33 | * @param {Object} scope Optional scope for the callback.
34 | * @param {Mixed[]} parameters Optional callback parameters.
35 | ###
36 | nextTick: Ext.emptyFn
37 |
38 | ###*
39 | * @method
40 | * Evalutes whether the specified value is a Function.
41 | * Also available as Deft.isFunction().
42 | * **NOTE:** Ext JS 4.2.0 and 4.2.1 shipped with a broken version of Ext.isFunction.
43 | * @param {Mixed} value Value to evaluate.
44 | * @return {Boolean}
45 | ###
46 | isFunction: Ext.emptyFn
47 |
48 | ###*
49 | * Creates a new wrapper function that spreads the passed Array over the target function arguments.
50 | *
51 | * @param {Function} fn Function to wrap.
52 | * @param {Object} scope Optional scope in which to execute the wrapped function.
53 | * @return {Function} The new wrapper function.
54 | ###
55 | spread: ( fn, scope ) ->
56 | return ( array ) ->
57 | if not Ext.isArray( array )
58 | Ext.Error.raise( msg: "Error spreading passed Array over target function arguments: passed a non-Array." )
59 | return fn.apply( scope, array )
60 | ,
61 | ->
62 | if setImmediate?
63 | @nextTick = ( fn, scope, parameters ) ->
64 | if scope? or parameters?
65 | fn = Ext.Function.bind( fn, scope, parameters)
66 | setImmediate( fn )
67 | return
68 | else
69 | @nextTick = ( fn, scope, parameters ) ->
70 | if scope? or parameters?
71 | fn = Ext.Function.bind( fn, scope, parameters )
72 | setTimeout( fn, 0 )
73 | return
74 |
75 | if (typeof document isnt 'undefined' and typeof document.getElementsByTagName( 'body' ) is 'function')
76 | # Safari 3.x and 4.x return 'function' for typeof - fall back to Object.prototype.toString (slower)
77 | @isFunction = (value) -> !!value and toString.call(value) is '[object Function]'
78 | else
79 | @isFunction = (value) -> !!value and typeof value is 'function'
80 |
81 | Deft.isFunction = @isFunction
82 |
83 | return
84 | )
--------------------------------------------------------------------------------
/packages/deft/src/coffee/promise/Deferred.coffee:
--------------------------------------------------------------------------------
1 | ###
2 | Copyright (c) 2012-2014 [DeftJS Framework Contributors](http://deftjs.org)
3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).
4 | ###
5 |
6 | ###*
7 | * A Deferred is typically used within the body of a function that performs
8 | * an asynchronous operation. When that operation succeeds, the Deferred
9 | * should be resolved; if that operation fails, the Deferred should be rejected.
10 | *
11 | * Deferreds are the mechanism used to create new Promises. A Deferred has a
12 | * single associated Promise that can be safely returned to external consumers
13 | * to ensure they do not interfere with the resolution or rejection of the
14 | * deferred operation.
15 | ###
16 | Ext.define( 'Deft.promise.Deferred',
17 | alternateClassName: [ 'Deft.Deferred' ]
18 | requires: [
19 | 'Deft.promise.Resolver'
20 | ]
21 |
22 | statics:
23 | ###*
24 | * Convenience method that returns a Promise resolved with the specified value.
25 | *
26 | * @param {Mixed} value Value to resolve as either a fulfillment value or rejection reason.
27 | * @return {Deft.promise.Promise} Resolved Promise.
28 | ###
29 | resolve: ( value ) ->
30 | deferred = Ext.create( 'Deft.promise.Deferred' )
31 | deferred.resolve( value )
32 | return deferred.promise
33 |
34 | ###*
35 | * Convenience method that returns a new Promise rejected with the specified reason.
36 | *
37 | * @param {Error} reason Rejection reason.
38 | * @return {Deft.promise.Promise} Rejected Promise.
39 | ###
40 | reject: ( reason ) ->
41 | deferred = Ext.create( 'Deft.promise.Deferred' )
42 | deferred.reject( reason )
43 | return deferred.promise
44 |
45 | ###*
46 | * @property {Deft.promise.Promise}
47 | * Promise of the future value of this Deferred.
48 | ###
49 | promise: null
50 |
51 | ###*
52 | * @private
53 | * @property {Deft.promise.Resolver}
54 | * Internal Resolver for this Deferred.
55 | ###
56 | resolver: null
57 |
58 | constructor: ->
59 | @resolver = Ext.create( 'Deft.promise.Resolver' )
60 | @promise = @resolver.promise
61 | return @
62 |
63 | ###*
64 | * Resolve this Deferred with the specified value.
65 | *
66 | * Once a Deferred has been fulfilled or rejected, it is considered to be complete
67 | * and subsequent calls to resolve() or reject() are ignored.
68 | *
69 | * @param {Mixed} value Value to resolve as either a fulfillment value or rejection reason.
70 | ###
71 | resolve: ( value ) ->
72 | @resolver.resolve( value )
73 | return
74 |
75 | ###*
76 | * Reject this Deferred with the specified error.
77 | *
78 | * Once a Deferred has been rejected, it is considered to be complete
79 | * and subsequent calls to resolve() or reject() are ignored.
80 | *
81 | * @param {Error} reason Rejection reason.
82 | ###
83 | reject: ( reason ) ->
84 | @resolver.reject( reason )
85 | return
86 |
87 | ###*
88 | * Update progress for this Deferred, if it is still pending.
89 | *
90 | * @param {Mixed} progress Progress value.
91 | ###
92 | update: ( progress ) ->
93 | @resolver.update( progress )
94 | return
95 |
96 | ###*
97 | * Return the Promise of the future value of this Deferred.
98 | *
99 | * @return {Deft.promise.Promise} Promise of the future value.
100 | ###
101 | getPromise: ->
102 | return @promise
103 | )
--------------------------------------------------------------------------------
/packages/deft/.sencha/package/bootstrap-impl.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
32 | @{launchcode}
33 |
34 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/packages/deft/src/coffee/event/LiveEventBus.coffee:
--------------------------------------------------------------------------------
1 | ###
2 | Copyright (c) 2012-2013 [DeftJS Framework Contributors](http://deftjs.org)
3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).
4 | ###
5 |
6 | ###*
7 | * Event bus for live component selectors.
8 | * @private
9 | ###
10 | Ext.define( 'Deft.event.LiveEventBus',
11 | alternateClassName: [ 'Deft.LiveEventBus' ]
12 | requires: [
13 | 'Ext.Component'
14 | 'Ext.ComponentManager'
15 |
16 | 'Deft.event.LiveEventListener'
17 | ]
18 | singleton: true
19 |
20 | constructor: ->
21 | @listeners = []
22 | return
23 |
24 | destroy: ->
25 | for listener in @listeners
26 | listener.destroy()
27 | @listeners = null
28 | return
29 |
30 | addListener: ( container, selector, eventName, fn, scope, options ) ->
31 | listener = Ext.create( 'Deft.event.LiveEventListener',
32 | container: container
33 | selector: selector
34 | eventName: eventName
35 | fn: fn
36 | scope: scope
37 | options: options
38 | )
39 | @listeners.push( listener )
40 | return
41 |
42 | removeListener: ( container, selector, eventName, fn, scope ) ->
43 | listener = @findListener( container, selector, eventName, fn, scope )
44 | if listener?
45 | Ext.Array.remove( @listeners, listener )
46 | listener.destroy()
47 | return
48 |
49 | on: ( container, selector, eventName, fn, scope, options ) ->
50 | return @addListener( container, selector, eventName, fn, scope, options )
51 |
52 | un: ( container, selector, eventName, fn, scope ) ->
53 | return @removeListener( container, selector, eventName, fn, scope )
54 |
55 | # @private
56 | findListener: ( container, selector, eventName, fn, scope ) ->
57 | for listener in @listeners
58 | # NOTE: Evaluating here rather than refactoring as a `Deft.event.LiveEventListener` method in order to reduce the number of function calls executed (for performance reasons).
59 | # TODO: Optimize via an index by selector, eventName (and maybe container id?).
60 | if listener.container is container and listener.selector is selector and listener.eventName is eventName and listener.fn is fn and listener.scope is scope
61 | return listener
62 | return null
63 |
64 | # @private
65 | register: ( component ) ->
66 | component.on( 'added', @onComponentAdded, @ )
67 | component.on( 'removed', @onComponentRemoved, @ )
68 | return
69 |
70 | # @private
71 | unregister: ( component ) ->
72 | component.un( 'added', @onComponentAdded, @ )
73 | component.un( 'removed', @onComponentRemoved, @ )
74 | return
75 |
76 | # @private
77 | onComponentAdded: ( component, container, eOpts ) ->
78 | for listener in @listeners
79 | listener.register( component )
80 | return
81 |
82 | # @private
83 | onComponentRemoved: ( component, container, eOpts ) ->
84 | for listener in @listeners
85 | listener.unregister( component )
86 | return
87 | ,
88 | ->
89 | Ext.Function.interceptAfter(
90 | Ext.ComponentManager,
91 | 'register',
92 | ( component ) ->
93 | Deft.event.LiveEventBus.register( component ) if component.isObservable && component.on && component.un
94 | return
95 | )
96 |
97 | Ext.Function.interceptAfter(
98 | Ext.ComponentManager,
99 | 'unregister',
100 | ( component ) ->
101 | Deft.event.LiveEventBus.unregister( component ) if component.isObservable && component.on && component.un
102 | return
103 | )
104 |
105 | return
106 | )
107 |
--------------------------------------------------------------------------------
/packages/deft/src/coffee/promise/Chain.coffee:
--------------------------------------------------------------------------------
1 | ###
2 | Copyright (c) 2012-2013 [DeftJS Framework Contributors](http://deftjs.org)
3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).
4 |
5 | sequence(), parallel(), pipeline() methods adapted from:
6 | [when.js](https://github.com/cujojs/when)
7 | Copyright (c) B Cavalier & J Hann
8 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).
9 | ###
10 |
11 | ###*
12 | * A collection of useful static methods for chaining execution of an Array of Functions using {@link Deft.promise.Promise Promises}.
13 | ###
14 | Ext.define( 'Deft.promise.Chain',
15 | alternateClassName: [ 'Deft.Chain' ]
16 | requires: [
17 | 'Deft.promise.Promise'
18 | 'Deft.util.Function'
19 | ]
20 |
21 | statics:
22 | ###*
23 | * Execute an Array (or {@link Deft.promise.Promise Promise} of an Array) of functions sequentially.
24 | *
25 | * The specified functions may optionally return their results as {@link Deft.promise.Promise Promises}.
26 | *
27 | * @param {Function[]/Deft.promise.Promise} fns The Array (or Promise of an Array) of functions to execute.
28 | * @param {Object} scope Optional scope in which to execute the specified functions.
29 | * @return {Deft.promise.Promise} Promise of an Array of results for each function call (in the same order).
30 | ###
31 | sequence: ( fns, scope = null ) ->
32 | args = [].slice.call( arguments, 2 )
33 | return Deft.Promise.reduce(
34 | fns
35 | ( results, fn ) ->
36 | if not Deft.isFunction( fn )
37 | throw new Error( 'Invalid parameter: expected a function.' )
38 | return Deft.Promise.when( fn.apply( scope, args ) ).then( ( result ) ->
39 | results.push( result )
40 | return results
41 | )
42 | []
43 | )
44 |
45 | ###*
46 | * Execute an Array (or {@link Deft.promise.Promise Promise} of an Array) of functions in parallel.
47 | *
48 | * The specified functions may optionally return their results as {@link Deft.promise.Promise Promises}.
49 | *
50 | * @param {Function[]/Deft.promise.Promise} fns The Array (or Promise of an Array) of functions to execute.
51 | * @param {Object} scope Optional scope in which to execute the specified functions.
52 | * @return {Deft.promise.Promise} Promise of an Array of results for each function call (in the same order).
53 | ###
54 | parallel: ( fns, scope = null ) ->
55 | args = [].slice.call( arguments, 2 )
56 | return Deft.Promise.map(
57 | fns
58 | ( fn ) ->
59 | if not Ext.isFunction( fn )
60 | throw new Error( 'Invalid parameter: expected a function.' )
61 | return fn.apply( scope, args )
62 | )
63 |
64 | ###*
65 | * Execute an Array (or {@link Deft.promise.Promise Promise} of an Array) of functions as a pipeline, where each function's result is passed to the subsequent function as input.
66 | *
67 | * The specified functions may optionally return their results as {@link Deft.promise.Promise Promises}.
68 | *
69 | * @param {Function[]/Deft.promise.Promise} fns The Array (or Promise of an Array) of functions to execute.
70 | * @param {Object} initialValue Initial value to be passed to the first function in the pipeline.
71 | * @param {Object} scope Optional scope in which to execute the specified functions.
72 | * @return {Deft.promise.Promise} Promise of the result value for the final function in the pipeline.
73 | ###
74 | pipeline: ( fns, initialValue, scope = null ) ->
75 | return Deft.Promise.reduce(
76 | fns
77 | ( value, fn ) ->
78 | if not Ext.isFunction( fn )
79 | throw new Error( 'Invalid parameter: expected a function.' )
80 | return fn.call( scope, value )
81 | initialValue
82 | )
83 | )
--------------------------------------------------------------------------------
/packages/deft/test/coffee/log/Logger.coffee:
--------------------------------------------------------------------------------
1 | ###
2 | Copyright (c) 2012 [DeftJS Framework Contributors](http://deftjs.org)
3 | Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).
4 | ###
5 |
6 | describe( 'Deft.log.Logger', ->
7 |
8 | describe( 'log()', ->
9 |
10 |
11 | describe( 'logs a message with the specified priority', ->
12 | logFunction = null
13 |
14 | checkCall = ( message, priority ) ->
15 | expect( logFunction ).to.be.calledOnce.and.calledWith( message, priority )
16 |
17 | beforeEach( ->
18 | logFunction = sinon.stub( Ext.Logger, 'log' )
19 | return
20 | )
21 |
22 | afterEach( ->
23 | logFunction.restore()
24 | return
25 | )
26 |
27 | specify( 'no priority specified', ->
28 | Deft.Logger.log( 'message', 'info' )
29 |
30 | checkCall( 'message', 'info' )
31 | return
32 | )
33 |
34 | specify( 'verbose', ->
35 | Deft.Logger.log( 'message', 'verbose' )
36 |
37 | checkCall( 'message', 'info' )
38 | return
39 | )
40 |
41 | specify( 'deprecate', ->
42 | Deft.Logger.log( 'message', 'deprecate' )
43 |
44 | checkCall( 'message', 'warn' )
45 | return
46 | )
47 |
48 | specify( 'warn', ->
49 | Deft.Logger.log( 'message', 'warn' )
50 |
51 | checkCall( 'message', 'warn' )
52 | return
53 | )
54 |
55 | specify( 'error', ->
56 | Deft.Logger.log( 'message', 'error' )
57 |
58 | checkCall( 'message', 'error' )
59 | return
60 | )
61 |
62 | return
63 | )
64 |
65 | )
66 |
67 | describe( 'verbose()', ->
68 | logFunction = null
69 |
70 | beforeEach( ->
71 | logFunction = sinon.stub( Deft.Logger, 'log' )
72 | )
73 |
74 | afterEach( ->
75 | logFunction.restore()
76 | )
77 |
78 | specify( 'calls log() with specified message with verbose priority', ->
79 | Deft.Logger.verbose( 'message' )
80 |
81 | expect( logFunction ).to.be.calledOnce.and.calledWith( 'message', 'verbose' )
82 | return
83 | )
84 |
85 | return
86 | )
87 |
88 | describe( 'info()', ->
89 | logFunction = null
90 |
91 | beforeEach( ->
92 | logFunction = sinon.stub( Deft.Logger, 'log' )
93 | )
94 |
95 | afterEach( ->
96 | logFunction.restore()
97 | )
98 |
99 | specify( 'calls log() with specified message with info priority', ->
100 | Deft.Logger.info( 'message' )
101 |
102 | expect( logFunction ).to.be.calledOnce.and.calledWith( 'message', 'info' )
103 | return
104 | )
105 |
106 | return
107 | )
108 |
109 | describe( 'deprecate()', ->
110 | logFunction = null
111 |
112 | beforeEach( ->
113 | logFunction = sinon.stub( Deft.Logger, 'log' )
114 | )
115 |
116 | afterEach( ->
117 | logFunction.restore()
118 | )
119 |
120 | specify( 'calls log() with specified message with deprecate priority', ->
121 | Deft.Logger.deprecate( 'message' )
122 |
123 | expect( logFunction ).to.be.calledOnce.and.calledWith( 'message', 'deprecate' )
124 | return
125 | )
126 |
127 | return
128 | )
129 |
130 | describe( 'warn()', ->
131 | logFunction = null
132 |
133 | beforeEach( ->
134 | logFunction = sinon.stub( Deft.Logger, 'log' )
135 | )
136 |
137 | afterEach( ->
138 | logFunction.restore()
139 | )
140 |
141 | specify( 'calls log() with specified message with warn priority', ->
142 | Deft.Logger.warn( 'message' )
143 |
144 | expect( logFunction ).to.be.calledOnce.and.calledWith( 'message', 'warn' )
145 | return
146 | )
147 |
148 | return
149 | )
150 |
151 | describe( 'error()', ->
152 | logFunction = null
153 |
154 | beforeEach( ->
155 | logFunction = sinon.stub( Deft.Logger, 'log' )
156 | )
157 |
158 | afterEach( ->
159 | logFunction.restore()
160 | )
161 |
162 | specify( 'calls log() with specified message with error priority', ->
163 | Deft.Logger.error( 'message' )
164 |
165 | expect( logFunction ).to.be.calledOnce.and.calledWith( 'message', 'error' )
166 | return
167 | )
168 |
169 | return
170 | )
171 |
172 | return
173 | )
174 |
--------------------------------------------------------------------------------
/packages/deft/test/lib/sinon-chai-2.4.0/sinon-chai.js:
--------------------------------------------------------------------------------
1 | (function (sinonChai) {
2 | "use strict";
3 |
4 | // Module systems magic dance.
5 |
6 | if (typeof require === "function" && typeof exports === "object" && typeof module === "object") {
7 | // NodeJS
8 | module.exports = sinonChai;
9 | } else if (typeof define === "function" && define.amd) {
10 | // AMD
11 | define(function () {
12 | return sinonChai;
13 | });
14 | } else {
15 | // Other environment (usually
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
179 |
180 |
191 |
192 |
193 |
194 |
195 |
Choose Target Framework:
196 |
218 |
219 |
220 |
221 |
222 |