Skip to content

Commit

Permalink
Merge remote-tracking branch 'github/master' into autocomplete-picker
Browse files Browse the repository at this point in the history
  • Loading branch information
charlieTheBotDev committed Jun 15, 2016
2 parents 8fb0116 + f7b5c60 commit 10b66bb
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 31 deletions.
18 changes: 14 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
language: node_js
node_js:
- "5"
- "4"
- "0.12"
- "0.11"
- '5'
- '4'
- '0.12'
- '0.11'
script: npm test && npm run combine-coverage && npm run upload-coverage
deploy:
provider: npm
email: hexagonj.ci.noreply@ocado.com
api_key:
secure: GpXKIC946J3acPqCmUCMUa+/g6vHh0mSkAw0ut7HpLYUBpUnNKZGHNePevOum/jxeAjMQOSAIlUW9nWo2A9wkrx7hV7mwIhTOhIQiSqGrQ/kOyAEWNXWGgrKSlzbEyOzUVJfSfesfPgGSc2gO6JjgCFuxgi7nEMrjyUdCf5Vl7lYq6HqQtbO3wcguDtq9lYbxwZ4PoDf8bN2j2aanj/Fk9KcyqAdIrUdRmOq5U3k0BcaQg31w1iaOPr4ES3UoxN/QCa+m+5ZqBYdt2Ekms7Hb8rukneTV94XaaRT2qmdQAAZfi7X66yO/z14nlpEO3z+i5kYeutdw7KoTVNhKCmbrscTB+pJ6agGk7pZkrEAlRH3DIo9k3VPo/GeifflpUWZXvQwzfEq3iaO6XtgN63NITMcuhXqykjk+u2DSCUhyiNuwf/WYlbAJWp+vYo+fnHQGpt/jRAedVPFad+NDfbJxUXluEnMCE1ujpflyIXdab3yZFrO5Hg36xdwd2tq3vAXRm/3R39h38EMLn1DkD9O5OWY0AkbXfzLLtYydmD8JHOXD9R8yzeaudcQi3Gkqt5K1dVqmNDsjP6eaC5aMRmUqRFTqt06wmQxS8yFSQQZCJDTIPztYmfb54icFNRAklA4I2QRKd/WGQ4PtBxnLQOa8zeuAp4T61aHxNx21Znt5Ts=
on:
branch: master
repo: ocadotechnology/hexagonjs
node: "4"
tags: true
2 changes: 1 addition & 1 deletion dist/hexagon-dark/hexagon.core.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
----------------------------------------------------
Version: 1.3.0
Version: 1.3.2
Theme: hexagon-dark
Modules:
set
Expand Down
2 changes: 1 addition & 1 deletion dist/hexagon-dark/hexagon.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
----------------------------------------------------
Version: 1.3.0
Version: 1.3.2
Theme: hexagon-dark
Modules:
set
Expand Down
13 changes: 7 additions & 6 deletions dist/hexagon-dark/hexagon.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

----------------------------------------------------

Version: 1.3.0
Version: 1.3.2
Theme: hexagon-dark
Modules:
set
Expand Down Expand Up @@ -1308,7 +1308,7 @@ hx.tween = function(start, end, amount) {
};

hx.defined = function(x) {
return x !== void 0;
return x !== void 0 && x !== null;
};

hx.zip = function(arrays) {
Expand Down Expand Up @@ -5352,10 +5352,11 @@ context = function(contextArray, contextPrefix) {
if (arguments.length > 1) {
selection.classed(mappedContexts, false);
if (contextArray.indexOf(context) !== -1) {
return selection.classed(contextPrefix + "-" + context, true);
selection.classed(contextPrefix + "-" + context, true);
} else if (context) {
return hx.consoleWarning(context + " is not a known context! Accepted values are " + (contextArray.join(', ')));
hx.consoleWarning(context + " is not a known context! Accepted values are " + (contextArray.join(', ')));
}
return selection;
} else {
for (i = 0, len = paletteContexts.length; i < len; i++) {
context = paletteContexts[i];
Expand Down Expand Up @@ -17829,7 +17830,7 @@ FileInput = (function(superClass) {
dragEnabled: true,
buttonClass: 'hx-action',
noFilesText: 'No File Chosen',
filesselectedFiles: 'Files Selected',
filesSelectedText: 'Files Selected',
buttonText: 'Choose File'
};
resolvedOptions = hx.merge(defaults, options);
Expand Down Expand Up @@ -17886,7 +17887,7 @@ FileInput = (function(superClass) {
}
selectedFiles.append(filePreview(fileMap.values()[0]));
} else {
selectedFiles.classed('hx-btn', true).add(hx.section().text(length + " Files Selected")).add(hx.detached('i')["class"]('hx-file-input-dropdown-icon hx-icon hx-icon-chevron-down')).on('click', 'hx.file-input', function() {
selectedFiles.classed('hx-btn', true).add(hx.section().text(length + " " + resolvedOptions.filesSelectedText)).add(hx.detached('i')["class"]('hx-file-input-dropdown-icon hx-icon hx-icon-chevron-down')).on('click', 'hx.file-input', function() {
return dropdown.show();
});
}
Expand Down
2 changes: 1 addition & 1 deletion dist/hexagon-dark/hexagon.theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
----------------------------------------------------
Version: 1.3.0
Version: 1.3.2
Theme: hexagon-dark
Modules:
set
Expand Down
2 changes: 1 addition & 1 deletion dist/hexagon-light/hexagon.core.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
----------------------------------------------------
Version: 1.3.0
Version: 1.3.2
Theme: hexagon-light
Modules:
set
Expand Down
2 changes: 1 addition & 1 deletion dist/hexagon-light/hexagon.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
----------------------------------------------------
Version: 1.3.0
Version: 1.3.2
Theme: hexagon-light
Modules:
set
Expand Down
13 changes: 7 additions & 6 deletions dist/hexagon-light/hexagon.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

----------------------------------------------------

Version: 1.3.0
Version: 1.3.2
Theme: hexagon-light
Modules:
set
Expand Down Expand Up @@ -1307,7 +1307,7 @@ hx.tween = function(start, end, amount) {
};

hx.defined = function(x) {
return x !== void 0;
return x !== void 0 && x !== null;
};

hx.zip = function(arrays) {
Expand Down Expand Up @@ -5351,10 +5351,11 @@ context = function(contextArray, contextPrefix) {
if (arguments.length > 1) {
selection.classed(mappedContexts, false);
if (contextArray.indexOf(context) !== -1) {
return selection.classed(contextPrefix + "-" + context, true);
selection.classed(contextPrefix + "-" + context, true);
} else if (context) {
return hx.consoleWarning(context + " is not a known context! Accepted values are " + (contextArray.join(', ')));
hx.consoleWarning(context + " is not a known context! Accepted values are " + (contextArray.join(', ')));
}
return selection;
} else {
for (i = 0, len = paletteContexts.length; i < len; i++) {
context = paletteContexts[i];
Expand Down Expand Up @@ -17828,7 +17829,7 @@ FileInput = (function(superClass) {
dragEnabled: true,
buttonClass: 'hx-action',
noFilesText: 'No File Chosen',
filesselectedFiles: 'Files Selected',
filesSelectedText: 'Files Selected',
buttonText: 'Choose File'
};
resolvedOptions = hx.merge(defaults, options);
Expand Down Expand Up @@ -17885,7 +17886,7 @@ FileInput = (function(superClass) {
}
selectedFiles.append(filePreview(fileMap.values()[0]));
} else {
selectedFiles.classed('hx-btn', true).add(hx.section().text(length + " Files Selected")).add(hx.detached('i')["class"]('hx-file-input-dropdown-icon hx-icon hx-icon-chevron-down')).on('click', 'hx.file-input', function() {
selectedFiles.classed('hx-btn', true).add(hx.section().text(length + " " + resolvedOptions.filesSelectedText)).add(hx.detached('i')["class"]('hx-file-input-dropdown-icon hx-icon hx-icon-chevron-down')).on('click', 'hx.file-input', function() {
return dropdown.show();
});
}
Expand Down
2 changes: 1 addition & 1 deletion dist/hexagon-light/hexagon.theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
----------------------------------------------------
Version: 1.3.0
Version: 1.3.2
Theme: hexagon-light
Modules:
set
Expand Down
4 changes: 2 additions & 2 deletions modules/file-input/main/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class FileInput extends hx.EventEmitter
dragEnabled: true
buttonClass: 'hx-action'
noFilesText: 'No File Chosen'
filesselectedFiles: 'Files Selected'
filesSelectedText: 'Files Selected'
buttonText: 'Choose File'

resolvedOptions = hx.merge defaults, options
Expand Down Expand Up @@ -125,7 +125,7 @@ class FileInput extends hx.EventEmitter
else
selectedFiles
.classed 'hx-btn', true
.add hx.section().text "#{length} Files Selected"
.add hx.section().text "#{length} #{resolvedOptions.filesSelectedText}"
.add hx.detached('i').class 'hx-file-input-dropdown-icon hx-icon hx-icon-chevron-down'
.on 'click', 'hx.file-input', -> dropdown.show()
else
Expand Down
1 change: 1 addition & 0 deletions modules/palette/main/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ context = (contextArray, contextPrefix) ->
selection.classed("#{contextPrefix}-#{context}", true)
else if context
hx.consoleWarning "#{context} is not a known context! Accepted values are #{contextArray.join(', ')}"
selection
else
for context in paletteContexts
if selection.classed("#{contextPrefix}-#{context}") then return context
Expand Down
13 changes: 9 additions & 4 deletions modules/palette/test/spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,31 @@ describe 'Palette', ->
it context, ->
selection = hx.detached('div')
hx.palette[type](selection, context).should.equal(selection)
selection.classed("#{prefix}-#{context}").should.equal(true)
hx.palette[type](selection.node()).should.equal(context)
if (context)
selection.classed("#{prefix}-#{context}").should.equal(true)
hx.palette[type](selection.node()).should.equal(context)
else
should.not.exist(hx.palette[type](selection.node()))
hx.consoleWarning.should.not.have.been.called()

testContexts.forEach testContext

testContext(undefined)

it 'should return undefined if there is no context', ->
should.not.exist(hx.palette.context(hx.detached('div')))
hx.consoleWarning.should.not.have.been.called()

it 'should remove existing context classes', ->
selection = hx.detached('div').class("#{prefix}-positive #{prefix}-negative")
hx.palette[type](selection, 'positive')
hx.palette[type](selection, 'positive').should.equal(selection)
selection.classed("#{prefix}-positive").should.equal(true)
selection.classed("#{prefix}-negative").should.equal(false)
hx.consoleWarning.should.not.have.been.called()

it 'supplying undefined should remove existing context classes', ->
selection = hx.detached('div').class("#{prefix}-positive #{prefix}-negative")
hx.palette[type](selection, undefined)
hx.palette[type](selection, undefined).should.equal(selection)
selection.classed("#{prefix}-positive").should.equal(false)
selection.classed("#{prefix}-negative").should.equal(false)
hx.consoleWarning.should.not.have.been.called()
Expand Down
2 changes: 1 addition & 1 deletion modules/util/main/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ hx.startsWith = (string, substring) -> string.lastIndexOf(substring, 0) is 0

hx.tween = (start, end, amount) -> start + (end - start) * amount

hx.defined = (x) -> x isnt undefined
hx.defined = (x) -> x isnt undefined and x isnt null

hx.zip = (arrays) ->
if arrays
Expand Down
10 changes: 10 additions & 0 deletions modules/util/test/spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -510,3 +510,13 @@ describe "Util", ->
inner.innerHTML.should.equal('Dave<div></div>')
inner.childNodes[0].nodeValue.should.equal('Dave')
inner.childNodes[1].innerHTML.should.equal('')

it 'defined: should return true for non-null and non-undefined values', ->
hx.defined(123).should.equal(true)
hx.defined("123").should.equal(true)
hx.defined({}).should.equal(true)
hx.defined(/123/).should.equal(true)

it 'defined: should return false for null and undefined', ->
hx.defined(null).should.equal(false)
hx.defined(undefined).should.equal(false)
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hexagon-js",
"version": "1.3.0",
"version": "1.3.2",
"description": "A modular, themeable collection of components for modern browsers",
"author": "James Smyth <james.smyth@ocado.com>",
"contributors": [
Expand All @@ -21,7 +21,7 @@
"main": "index.js",
"scripts": {
"start": "node demo.js",
"dist": "node build/main/dist.js",
"prepare-release": "node build/main/dist.js",
"test": "npm run test-build && npm run test-library",
"test-build": "./node_modules/istanbul/lib/cli.js cover --dir target/test-build/coverage ./node_modules/mocha/bin/_mocha -- --ui bdd -R spec build/test",
"test-library": "node build/main/test.js",
Expand Down

0 comments on commit 10b66bb

Please sign in to comment.