mirror of
https://github.com/pebble-dev/clay.git
synced 2026-08-27 20:36:33 -04:00
pass minified to initialize function
This commit is contained in:
+3
-2
@@ -8,7 +8,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"test-travis": "./node_modules/.bin/karma start ./test/karma.conf.js --single-run --browsers chromeTravisCI && ./node_modules/.bin/eslint ./",
|
||||
"test-debug": "DEBUG=true && ./node_modules/.bin/karma start ./test/karma.conf.js --no-single-run",
|
||||
"test-debug": "(export DEBUG=true && ./node_modules/.bin/karma start ./test/karma.conf.js --no-single-run)",
|
||||
"test": "./node_modules/.bin/karma start ./test/karma.conf.js --single-run",
|
||||
"lint": "./node_modules/.bin/eslint ./",
|
||||
"build": "gulp"
|
||||
@@ -28,7 +28,6 @@
|
||||
},
|
||||
"homepage": "https://github.com/pebble/clay#readme",
|
||||
"devDependencies": {
|
||||
"pebble-clay-components": "git+https://github.com/pebble/clay-components.git#master",
|
||||
"browserify": "^13.0.0",
|
||||
"browserify-istanbul": "^0.2.1",
|
||||
"chai": "^3.4.1",
|
||||
@@ -52,6 +51,8 @@
|
||||
"karma-source-map-support": "^1.1.0",
|
||||
"karma-threshold-reporter": "^0.1.15",
|
||||
"mocha": "^2.3.4",
|
||||
"pebble-clay-components": "git+https://github.com/pebble/clay-components.git#master",
|
||||
"sassify": "^0.9.1",
|
||||
"sinon": "^1.17.3",
|
||||
"stringify": "^3.2.0",
|
||||
"vinyl-source-stream": "^1.1.0",
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var componentRegistry = require('./component-registry');
|
||||
var _ = require('../vendor/minified/minified')._;
|
||||
var HTML = require('../vendor/minified/minified').HTML;
|
||||
var minified = require('../vendor/minified/minified');
|
||||
var utils = require('../lib/utils');
|
||||
var ClayEvents = require('./clay-events');
|
||||
|
||||
var _ = minified._;
|
||||
var HTML = minified.HTML;
|
||||
|
||||
/**
|
||||
* @extends ClayEvents
|
||||
* @param {Clay~ConfigItem} config
|
||||
@@ -33,7 +35,7 @@ function ClayItem(config) {
|
||||
self.config = config;
|
||||
|
||||
/** @type {M} */
|
||||
self.$element = HTML(_.formatHtml(_component.template, _templateData));
|
||||
self.$element = HTML(_component.template.trim(), _templateData);
|
||||
|
||||
/** @type {M} */
|
||||
self.$manipulatorTarget = self.$element.select('[data-manipulator-target]');
|
||||
@@ -44,12 +46,13 @@ function ClayItem(config) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the initializer if it exists.
|
||||
* Run the initializer if it exists and attaches the css to the head.
|
||||
* Passes minified as the first param
|
||||
* @returns {ClayItem}
|
||||
*/
|
||||
self.initialize = function() {
|
||||
if (typeof _component.initialize === 'function') {
|
||||
_component.initialize.apply(self, arguments);
|
||||
_component.initialize.call(self, minified);
|
||||
}
|
||||
return self;
|
||||
};
|
||||
|
||||
@@ -4,6 +4,7 @@ var assert = require('chai').assert;
|
||||
var sinon = require('sinon');
|
||||
var checkReadOnly = require('../../test-utils').checkReadOnly;
|
||||
var ClayItem = require('../../../src/scripts/lib/clay-item');
|
||||
var minified = require('../../../src/scripts/vendor/minified/minified');
|
||||
var clayItemFixture = require('../../fixture').clayItem;
|
||||
var configItemFixture = require('../../fixture').configItem;
|
||||
var componentRegistry = require('../../../src/scripts/lib/component-registry');
|
||||
@@ -98,6 +99,7 @@ describe('ClayItem', function() {
|
||||
var initializeSpy = sinon.spy(componentRegistry.select, 'initialize');
|
||||
var clayItem = clayItemFixture('select').initialize();
|
||||
assert(initializeSpy.alwaysCalledOn(clayItem));
|
||||
assert(initializeSpy.alwaysCalledWith(minified));
|
||||
initializeSpy.restore();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user