Skip to content

Commit

Permalink
Merge branch 'GPII-2429'
Browse files Browse the repository at this point in the history
* jobara/GPII-2429:
  GPII-2429: Typo, used heads down camelCase instead of heads up.
  NOJIRA: Removing old TODO file
  GPII-2429: Update supported adaptations in README
  GPII-2429: Bumping version number in manifest.
  GPII-2429: Adding Character Spacing Preference
  GPII-2429: Updating to work with latest Infusion.
  • Loading branch information
javihernandez committed Apr 9, 2018
2 parents 350b941 + 05c24cf commit 5f52d94
Show file tree
Hide file tree
Showing 14 changed files with 235 additions and 49 deletions.
7 changes: 6 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ module.exports = function (grunt) {
"node_modules/infusion/src/framework/enhancement/js/ContextAwareness.js",
"node_modules/infusion/src/framework/enhancement/js/ProgressiveEnhancement.js",
"node_modules/infusion/src/components/tableOfContents/js/TableOfContents.js",
"node_modules/infusion/src/framework/preferences/js/Enactors.js"
"node_modules/infusion/src/framework/preferences/js/Enactors.js",
"node_modules/infusion/src/framework/preferences/js/LetterSpaceEnactor.js"
],
adjustersLib: [
// jQuery
Expand Down Expand Up @@ -101,7 +102,9 @@ module.exports = function (grunt) {
"node_modules/infusion/src/framework/preferences/js/PrefsEditor.js",
"node_modules/infusion/src/framework/preferences/js/Panels.js",
"node_modules/infusion/src/framework/preferences/js/SelfVoicingPanel.js",
"node_modules/infusion/src/framework/preferences/js/LetterSpacePanel.js",
"node_modules/infusion/src/framework/preferences/js/Enactors.js",
"node_modules/infusion/src/framework/preferences/js/LetterSpaceEnactor.js",
"node_modules/infusion/src/framework/preferences/js/StarterGrades.js",
"node_modules/infusion/src/framework/preferences/js/ArrowScrolling.js",
"node_modules/infusion/src/framework/preferences/js/SeparatedPanelPrefsEditor.js",
Expand All @@ -110,6 +113,7 @@ module.exports = function (grunt) {
"node_modules/infusion/src/framework/preferences/js/AuxBuilder.js",
"node_modules/infusion/src/framework/preferences/js/StarterSchemas.js",
"node_modules/infusion/src/framework/preferences/js/SelfVoicingSchemas.js",
"node_modules/infusion/src/framework/preferences/js/LetterSpaceSchemas.js",
"node_modules/infusion/src/framework/preferences/js/Builder.js",

// from extension
Expand All @@ -121,6 +125,7 @@ module.exports = function (grunt) {
"node_modules/infusion/src/components/tableOfContents/html/TableOfContents.html",
"node_modules/infusion/src/framework/preferences/html/PrefsEditorTemplate-textSize.html",
"node_modules/infusion/src/framework/preferences/html/PrefsEditorTemplate-lineSpace.html",
"node_modules/infusion/src/framework/preferences/html/PrefsEditorTemplate-letterSpace.html",
"node_modules/infusion/src/framework/preferences/html/PrefsEditorTemplate-contrast.html",
"node_modules/infusion/src/framework/preferences/html/PrefsEditorTemplate-layout.html",
"node_modules/infusion/src/framework/preferences/html/PrefsEditorTemplate-enhanceInputs.html",
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The following adaptations are supported:

* Text Size
* Line Space
* Character Space
* Contrast
* Right-Click to Select
* Selection Highlight
Expand Down
22 changes: 0 additions & 22 deletions TODO.md

This file was deleted.

2 changes: 1 addition & 1 deletion extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "UI Options Plus (UIO+)",
"short_name": "UIO+",
"version": "0.1.0.2",
"version": "0.1.0.3",
"description": "User Interface Options Plus (UIO+) allows you to customize websites to match your own personal needs and preferences.",
"author": "Fluid Project",
"permissions": [
Expand Down
6 changes: 6 additions & 0 deletions extension/messages/charSpace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"label": "Character Spacing",
"description": "Adjust the spacing between characters",
"increaseLabel": "increase character spacing",
"decreaseLabel": "decrease character spacing"
}
22 changes: 22 additions & 0 deletions extension/src/content_scripts/domEnactor.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@
}
}
},
charSpace: {
type: "gpii.chrome.enactor.charSpace",
options: {
model: {
value: "{domEnactor}.model.characterSpace"
}
}
},
inputsLarger: {
type: "gpii.chrome.enactor.inputsLarger",
options: {
Expand Down Expand Up @@ -145,6 +153,20 @@
}
});

// Character space
fluid.defaults("gpii.chrome.enactor.charSpace", {
gradeNames: ["fluid.prefs.enactor.letterSpace"],
fontSizeMap: {
"xx-small": "9px",
"x-small": "11px",
"small": "13px",
"medium": "15px",
"large": "18px",
"x-large": "23px",
"xx-large": "30px"
}
});

// Inputs larger
fluid.defaults("gpii.chrome.enactor.inputsLarger", {
gradeNames: ["fluid.prefs.enactor.enhanceInputs"],
Expand Down
14 changes: 12 additions & 2 deletions extension/src/lib/PrefsEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"preferences.gpii_chrome_prefs_contrast": "settings.contrastTheme",
"preferences.fluid_prefs_enhanceInputs": "settings.inputsLargerEnabled",
"preferences.gpii_chrome_prefs_lineSpace": "settings.lineSpace",
"preferences.fluid_prefs_letterSpace": "settings.characterSpace",
"preferences.fluid_prefs_tableOfContents": "settings.tableOfContentsEnabled",
"preferences.gpii_chrome_prefs_textSize": "settings.fontSize",
"preferences.fluid_prefs_speak": "settings.selfVoicingEnabled",
Expand Down Expand Up @@ -166,7 +167,7 @@
gradeNames: ["fluid.prefs.panel.textSize"],
preferenceMap: {
"gpii.chrome.prefs.textSize": {
"model.textSize": "default",
"model.value": "default",
"range.min": "minimum",
"range.max": "maximum",
"step": "divisibleBy"
Expand All @@ -178,7 +179,7 @@
gradeNames: ["fluid.prefs.panel.lineSpace"],
preferenceMap: {
"gpii.chrome.prefs.lineSpace": {
"model.lineSpace": "default",
"model.value": "default",
"range.min": "minimum",
"range.max": "maximum",
"step": "divisibleBy"
Expand Down Expand Up @@ -276,6 +277,15 @@
"template": "%templatePrefix/PrefsEditorTemplate-lineSpace.html"
}
},
"charSpace": {
"type": "fluid.prefs.letterSpace",
"panel": {
"type": "fluid.prefs.panel.letterSpace",
"container": ".flc-prefsEditor-char-space",
"message": "%messagePrefix/charSpace.json",
"template": "%templatePrefix/PrefsEditorTemplate-letterSpace.html"
}
},
"contrast": {
"type": "gpii.chrome.prefs.contrast",
"classes": {
Expand Down
1 change: 1 addition & 0 deletions extension/src/lib/domSettingsApplier.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ fluid.defaults("gpii.chrome.domSettingsApplier", {
// Accepted model values:
// settings.contrastTheme: string,
// settings.lineSpace: number, // the multiplier to the current line space
// settings.characterSpace: number,
// settings.inputsLarger: boolean,
// settings.selectionTheme: string,
// settings.simplifiedUiEnabled: boolean,
Expand Down
1 change: 1 addition & 0 deletions extension/templates/PrefsEditorPanel.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<ul class="fl-prefsEditor-panels">
<li class="flc-prefsEditor-panel fl-prefsEditor-panel"><div class="flc-prefsEditor-text-size"></div></li>
<li class="flc-prefsEditor-panel fl-prefsEditor-panel"><div class="flc-prefsEditor-line-space"></div></li>
<li class="flc-prefsEditor-panel fl-prefsEditor-panel"><div class="flc-prefsEditor-char-space"></div></li>
<li class="flc-prefsEditor-panel fl-prefsEditor-panel"><div class="flc-prefsEditor-contrast"></div></li>
<li class="flc-prefsEditor-panel fl-prefsEditor-panel"><div class="flc-prefsEditor-clickToSelect"></div></li>
<li class="flc-prefsEditor-panel fl-prefsEditor-panel"><div class="flc-prefsEditor-selectionHighlight"></div></li>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"test": "node tests/node/all-tests.js"
},
"dependencies": {
"infusion": "3.0.0-dev.20180227T185528Z.08741e844",
"infusion": "3.0.0-dev.20180312T184056Z.e4d2974d2",
"ws": "1.1.0"
},
"devDependencies": {
Expand Down
3 changes: 3 additions & 0 deletions tests/browser/html/domEnactorTests.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ <h2 id="qunit-userAgent"></h2>
</div>
<div class="gpii-test-contrast"></div>
<div class="gpii-test-lineSpace" style="line-height: 1.2;"></div>
<div style="font-size: 16px;">
<div class="gpii-test-charSpace" style="letter-spacing: 0.2em;"></div>
</div>
<div class="gpii-test-inputsLarger">
<button></button>
</div>
Expand Down
1 change: 1 addition & 0 deletions tests/browser/html/prefsEditorTests.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ <h2 id="qunit-userAgent"></h2>

<div class="gpiic-textSize"></div>
<div class="gpiic-lineSpace"></div>
<div class="gpiic-charSpace"></div>
<div class="gpiic-contrast"></div>
<div class="gpiic-highlight"></div>
<div class="gpiic-simplify"></div>
Expand Down
71 changes: 71 additions & 0 deletions tests/browser/js/domEnactorTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,76 @@
}]
});

/*************************
* Character Space Tests *
*************************/

fluid.defaults("gpii.tests.charSpaceTests", {
gradeNames: ["fluid.test.testEnvironment"],
components: {
charSpace: {
type: "fluid.prefs.enactor.letterSpace",
container: ".gpii-test-charSpace",
options: {
model: {
value: 1
}
}
},
charSpaceTester: {
type: "fluid.tests.charSpaceTester"
}
}
});

gpii.tests.charSpaceTests.assertCharSpace = function (that, expectedValue, baseCharSpace) {
baseCharSpace = baseCharSpace || 0;
var expectedUnit = fluid.roundToDecimal(expectedValue - 1, 2);
var expectedLetterSpacing = fluid.roundToDecimal(baseCharSpace + expectedUnit, 2) + "em";
jqUnit.assertEquals("The model value should be set to " + expectedValue, expectedValue, that.model.value);
jqUnit.assertEquals("The model unit should be set to " + expectedUnit, expectedUnit, that.model.unit);
jqUnit.assertEquals("The letter-spacing should be set to " + expectedLetterSpacing, "letter-spacing: " + expectedLetterSpacing + ";", that.container.attr("style"));
};

fluid.defaults("fluid.tests.charSpaceTester", {
gradeNames: ["fluid.test.testCaseHolder"],
modules: [{
name: "Character Space Tests",
tests: [{
name: "Model Changes",
expect: 12,
sequence: [{
func: "gpii.tests.charSpaceTests.assertCharSpace",
args: ["{charSpace}", 1, 0.2]
}, {
func: "{charSpace}.applier.change",
args: ["value", 1.3]
}, {
changeEvent: "{charSpace}.applier.modelChanged",
path: "value",
listener: "gpii.tests.charSpaceTests.assertCharSpace",
args: ["{charSpace}", 1.3, 0.2]
}, {
func: "{charSpace}.applier.change",
args: ["value", 2]
}, {
changeEvent: "{charSpace}.applier.modelChanged",
path: "value",
listener: "gpii.tests.charSpaceTests.assertCharSpace",
args: ["{charSpace}", 2, 0.2]
}, {
func: "{charSpace}.applier.change",
args: ["value", 1]
}, {
changeEvent: "{charSpace}.applier.modelChanged",
path: "value",
listener: "gpii.tests.charSpaceTests.assertCharSpace",
args: ["{charSpace}", 1, 0.2]
}]
}]
}]
});

/***********************
* Inputs Larger Tests *
***********************/
Expand Down Expand Up @@ -652,6 +722,7 @@
"gpii.tests.selectionHighlightTests",
"gpii.tests.contrastTests",
"gpii.tests.lineSpaceTests",
"gpii.tests.charSpaceTests",
"gpii.tests.inputsLargerTests",
"gpii.tests.tocTests",
"gpii.tests.domEnactorTests",
Expand Down
Loading

0 comments on commit 5f52d94

Please sign in to comment.