gpii-windows
Version:
Components of the GPII personalization infrastructure for use on Microsoft's "Windows" ™
66 lines (50 loc) • 2 kB
JavaScript
/*
* Tests for ribbon.js
*
* Copyright 2019 Raising the Floor - International
*
* Licensed under the New BSD license. You may not use this file except in
* compliance with this License.
*
* The R&D leading to these results received funding from the
* Department of Education - Grant H421A150005 (GPII-APCP). However,
* these results do not necessarily represent the policy of the
* Department of Education, and you should not assume endorsement by the
* Federal Government.
*
* You may obtain a copy of the License at
* https://github.com/GPII/universal/blob/master/LICENSE.txt
*/
;
require("../../WindowsUtilities/WindowsUtilities.js");
var fluid = require("gpii-universal");
var jqUnit = fluid.require("node-jqunit");
var gpii = fluid.registerNamespace("gpii");
fluid.registerNamespace("gpii.tests.officeRibbon");
require("../index.js");
jqUnit.module("gpii.tests.officeRibbon");
// Check it fails gracefully if the office automation instance can't be loaded
jqUnit.asyncTest("Testing ribbon reloading (successful failure)", function () {
jqUnit.expect(2);
var promise = gpii.windows.office.reloadRibbon("NoSuchApplication");
jqUnit.assertTrue("reloadRibbon must return a promise", fluid.isPromise(promise));
promise.then(function (value) {
jqUnit.assertFalse("Failing to access Office should resolve with false", value);
jqUnit.start();
}, jqUnit.fail);
});
// Perform a (sort of) successful run.
jqUnit.asyncTest("Testing ribbon reloading - no windows open", function () {
jqUnit.expect(2);
var officeObject = {
Windows: {
Count: 0
}
};
var promise = gpii.windows.office.reloadRibbon("TestApplication", null, officeObject);
jqUnit.assertTrue("reloadRibbon must return a promise", fluid.isPromise(promise));
promise.then(function (value) {
jqUnit.assertTrue("reloadRibbon should resolve with true", value);
jqUnit.start();
}, jqUnit.fail);
});