Skip to content

Commit

Permalink
Merge 829484e into e46cd6d
Browse files Browse the repository at this point in the history
  • Loading branch information
rodneyrehm committed Apr 25, 2016
2 parents e46cd6d + 829484e commit 3dd1ded
Show file tree
Hide file tree
Showing 5 changed files with 182 additions and 61 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Expand Up @@ -2,12 +2,16 @@

## master

* Reducing minified size from 127K to 76K (28K to 23K gzipped) by running [rollupify](https://github.com/nolanlawson/rollupify/).

---

* fixing `supports/focus-in-hiden-iframe` to avoid `document.write()` - [issue #126](https://github.com/medialize/ally.js/issues/126)
* adding [`ally.element.focus`][ally/element/focus] - [issue #121](https://github.com/medialize/ally.js/issues/121)
* removing `svgelement.prototype.focus` as this should be covered more elegantly by [`ally.element.focus`][ally/element/focus]
* fixing [`ally.element.disabled`][ally/element/disabled] to remove SVG links from the document's tabbing order in Firefox
* fixing [`ally.maintain.disabled`][ally/maintain/disabled] to *not* disable ancestors `filter` elements

* adding [rollupify](https://github.com/nolanlawson/rollupify/) to the build job

## 1.1.0 - Reality Strikes Back

Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -43,7 +43,7 @@
"build:post": "node build/build.post.js",
"build:archive": "node build/build.archive.js",
"build:umd": "npm-run-all --sequential build:umd:bundle build:umd:min build:umd:clean",
"build:umd:bundle": "browserify dist/src/ally.js --debug --standalone ally --transform babelify | exorcist dist/ally.js.map > dist/ally.js",
"build:umd:bundle": "browserify dist/src/ally.js --debug --standalone ally --transform rollupify --transform babelify | exorcist dist/ally.js.map > dist/ally.js",
"build:umd:clean": "rm dist/ally.js dist/ally.js.map",
"build:umd:min": "uglifyjs dist/ally.js --in-source-map dist/ally.js.map --source-map dist/ally.min.js.map --source-map-url ally.min.js.map --preamble \"/*! ${npm_package_name} - v${npm_package_version} - ${npm_package_homepage} - ${npm_package_license} License */\" --mangle --compress --output dist/ally.min.js",
"build:common": "babel --source-maps --modules common --out-dir dist/common dist/src",
Expand Down Expand Up @@ -115,6 +115,7 @@
"replace": "^0.3.0",
"requirejs": "^2.1.22",
"rimraf": "^2.5.2",
"rollupify": "^0.2.0",
"sequence-comparison-table": "^0.2.1",
"shelljs": "^0.6.0",
"sinon": "^1.17.3",
Expand Down
27 changes: 27 additions & 0 deletions test/browser.bundle.js
@@ -0,0 +1,27 @@
define(function(require) {
'use strict';

var config = require('./browser');
var allyModules = require('./helper/ally-modules');
var allyBundle = require('../dist/ally.min');

// intercept all ally.js modules and redirect them to
// the functions exposed in the built bundle
allyModules.map(function(namespace, module, internal) {
if (!namespace || internal) {
// not all modules are exposed in the dist bundle,
// but we'll want to run tests regardless
return;
}

var path = 'ally/' + namespace + '/' + module;
// for some reason the loader won't resolve this
// define(path, ['dist/ally.min'], function(ally) {});
define(path, [], function() {
var _module = allyModules.camelCase(module);
return allyBundle[namespace][_module];
});
});

return config;
});
142 changes: 142 additions & 0 deletions test/helper/ally-modules.js
@@ -0,0 +1,142 @@
define([], function() {
'use strict';

// to ignore sorting for now, we'll simply use what the core.worker.test requires:
// because all files are loaded in the same worker,
// we'll load the ones with the fewest dependencies first,
// so we don't hit timeouts caused by slow networks or VMs
var source = {
event: [
'active-element',
'shadow-focus',
],
prototype: [
'element.prototype.matches',
'window.customevent',
],
util: [
'context-to-element',
'decorate-context',
'decorate-service',
'merge-dom-order',
'node-array',
'tabindex-value',
'visible-area',
],
is: [
'disabled',
'active-element',
'focus-relevant',
'focusable',
'native-disabled-supported',
'only-tabbable',
'shadowed',
'tabbable',
'valid-area',
'valid-tabindex',
'visible',
],
get: [
'active-elements',
'focus-redirect-target',
'focus-target',
'insignificant-branches',
'parents',
'shadow-host-parents',
'shadow-host',
],
element: [
'blur',
'disabled',
'focus',
],
observe: [
'interaction-type',
'shadow-mutations',
],
query: [
'first-tabbable',
'focusable',
'shadow-hosts',
'tabbable',
'tabsequence.sort-area',
'tabsequence.sort-tabindex',
'tabsequence',
],
style: [
'focus-within',
'focus-source',
],
when: [
'focusable',
'key',
'visible-area',
],
fix: [
'pointer-focus-children',
'pointer-focus-input',
'pointer-focus-parent',
],
maintain: [
'disabled',
'hidden',
'tab-focus',
],
};

var internal = {
prototype: [
'element.prototype.matches',
'window.customevent',
],
util: [
'context-to-element',
'decorate-context',
'decorate-service',
'merge-dom-order',
'node-array',
'tabindex-value',
'visible-area',
],
is: [
'native-disabled-supported',
],
query: [
'tabsequence.sort-area',
'tabsequence.sort-tabindex',
],
};

function isInternal(namespace, name) {
return Boolean(internal[namespace] && internal[namespace].indexOf(name) !== -1);
}

function map(callback) {
var list = [];
Object.keys(source).forEach(function(namespace) {
source[namespace].forEach(function(name) {
list.push(callback(namespace, name, isInternal(namespace, name)));
});
});

list.push(callback(null, 'version'));
list.push(callback(null, 'ally'));

return list;
}

function camelCase(name) {
return name.replace(/-([a-z])/g, function(m, c) {
return c.toUpperCase();
});
}

return {
source: source,
internal: internal,
isInternal: isInternal,
camelCase: camelCase,
map: map,
};

});
65 changes: 6 additions & 59 deletions test/unit/core.worker.test.js
Expand Up @@ -4,69 +4,16 @@ define(function(require) {
var registerSuite = require('intern!object');
var expect = require('intern/chai!expect');
var TestWorker = require('../helper/test-worker');
var allyModules = require('../helper/ally-modules');

registerSuite(function() {
var worker;

// because all files are loaded in the same worker,
// we'll load the ones with the fewest dependencies first,
// so we don't hit timeouts caused by slow networks or VMs
var modules = [
'ally.js/event/active-element',
'ally.js/event/shadow-focus',
'ally.js/prototype/element.prototype.matches',
'ally.js/prototype/window.customevent',
'ally.js/util/context-to-element',
'ally.js/util/decorate-context',
'ally.js/util/decorate-service',
'ally.js/util/merge-dom-order',
'ally.js/util/node-array',
'ally.js/util/tabindex-value',
'ally.js/util/visible-area',
'ally.js/is/disabled',
'ally.js/is/active-element',
'ally.js/is/focus-relevant',
'ally.js/is/focusable',
'ally.js/is/native-disabled-supported',
'ally.js/is/only-tabbable',
'ally.js/is/shadowed',
'ally.js/is/tabbable',
'ally.js/is/valid-area',
'ally.js/is/valid-tabindex',
'ally.js/is/visible',
'ally.js/get/active-elements',
'ally.js/get/focus-redirect-target',
'ally.js/get/focus-target',
'ally.js/get/insignificant-branches',
'ally.js/get/parents',
'ally.js/get/shadow-host-parents',
'ally.js/get/shadow-host',
'ally.js/element/blur',
'ally.js/element/disabled',
'ally.js/element/focus',
'ally.js/observe/interaction-type',
'ally.js/observe/shadow-mutations',
'ally.js/query/first-tabbable',
'ally.js/query/focusable',
'ally.js/query/shadow-hosts',
'ally.js/query/tabbable',
'ally.js/query/tabsequence.sort-area',
'ally.js/query/tabsequence.sort-tabindex',
'ally.js/query/tabsequence',
'ally.js/style/focus-within',
'ally.js/style/focus-source',
'ally.js/when/focusable',
'ally.js/when/key',
'ally.js/when/visible-area',
'ally.js/version',
'ally.js/fix/pointer-focus-children',
'ally.js/fix/pointer-focus-input',
'ally.js/fix/pointer-focus-parent',
'ally.js/maintain/disabled',
'ally.js/maintain/hidden',
'ally.js/maintain/tab-focus',
'ally.js/ally',
];
// 'ally.js/<namespace>/<module>'
// 'ally.js/<module>'
var modules = allyModules.map(function(namespace, module) {
return ['ally.js', namespace, module].filter(Boolean).join('/');
});

var suite = {
name: 'core: WebWorker',
Expand Down

0 comments on commit 3dd1ded

Please sign in to comment.