diff --git a/commons/selfservice/example-ui/Gruntfile.js b/commons/selfservice/example-ui/Gruntfile.js index bb0ed6e09..40df3992e 100644 --- a/commons/selfservice/example-ui/Gruntfile.js +++ b/commons/selfservice/example-ui/Gruntfile.js @@ -29,12 +29,12 @@ module.exports = function(grunt) { watch: { sync_and_test: { files: [ - '<%= forgerockui %>/forgerock-ui-commons/src/main/js/**', - '<%= forgerockui %>/forgerock-ui-commons/src/main/resources/**', - //'<%= forgerockui %>/forgerock-ui-commons/src/test/qunit/**', - '<%= forgerockui %>/forgerock-ui-user/src/main/js/**', - '<%= forgerockui %>/forgerock-ui-user/src/main/resources/**', - //'<%= forgerockui %>/forgerock-ui-user/src/test/qunit/**', + '<%= forgerockui %>/commons/src/main/js/**', + '<%= forgerockui %>/commons/src/main/resources/**', + //'<%= forgerockui %>/commons/src/test/qunit/**', + '<%= forgerockui %>/user/src/main/js/**', + '<%= forgerockui %>/user/src/main/resources/**', + //'<%= forgerockui %>/user/src/test/qunit/**', 'src/main/js/**', 'src/main/resources/**', //'src/test/qunit/**', @@ -56,17 +56,17 @@ module.exports = function(grunt) { commons: { files: [ { - cwd : '<%= forgerockui %>/forgerock-ui-commons/src/main/js', + cwd : '<%= forgerockui %>/commons/src/main/js', src : ['**'], dest : 'target/www' }, { - cwd : '<%= forgerockui %>/forgerock-ui-commons/src/main/resources', + cwd : '<%= forgerockui %>/commons/src/main/resources', src : ['**'], dest : 'target/www' }/*, { - cwd : '<%= forgerockui %>/forgerock-ui-commons/src/test/qunit', + cwd : '<%= forgerockui %>/commons/src/test/qunit', src : ['**'], dest : 'target/test/tests' }*/ @@ -75,17 +75,17 @@ module.exports = function(grunt) { user: { files: [ { - cwd : '<%= forgerockui %>/forgerock-ui-user/src/main/js', + cwd : '<%= forgerockui %>/user/src/main/js', src : ['**'], dest : 'target/www' }, { - cwd : '<%= forgerockui %>/forgerock-ui-user/src/main/resources', + cwd : '<%= forgerockui %>/user/src/main/resources', src : ['**'], dest : 'target/www' }/*, { - cwd : '<%= forgerockui %>/forgerock-ui-user/src/test/qunit', + cwd : '<%= forgerockui %>/user/src/test/qunit', src : ['**'], dest : 'target/test/tests' }*/ diff --git a/ui/commons/.eslintrc b/ui/commons/.eslintrc index f94c3e81b..f6c1f5baf 100644 --- a/ui/commons/.eslintrc +++ b/ui/commons/.eslintrc @@ -1,6 +1,5 @@ { "root": true, - "extends": "forgerock", "env": { "amd": true, "browser": true, diff --git a/ui/commons/package.json b/ui/commons/package.json index 5cbfe6b81..7f23bc505 100644 --- a/ui/commons/package.json +++ b/ui/commons/package.json @@ -9,7 +9,6 @@ }, "devDependencies": { "eslint": "4.18.2", - "eslint-config-forgerock": "^1.0.0", "eslint-formatter-warning-summary": "^1.0.1", "grunt": "1.5.3", "grunt-cli": "1.4.3", diff --git a/ui/commons/src/main/js/config/process/CommonConfig.js b/ui/commons/src/main/js/config/process/CommonConfig.js index 1162efd0d..32ef3a934 100644 --- a/ui/commons/src/main/js/config/process/CommonConfig.js +++ b/ui/commons/src/main/js/config/process/CommonConfig.js @@ -108,7 +108,7 @@ define([ { startEvent: Constants.EVENT_UNAUTHORIZED, description: "", - dependencies: [ ], + dependencies: [], processDescription: function() { EventManager.sendEvent(Constants.EVENT_DISPLAY_MESSAGE_REQUEST, "unauthorized"); } diff --git a/ui/commons/src/main/js/config/validators/CommonValidators.js b/ui/commons/src/main/js/config/validators/CommonValidators.js index 4fca24d59..6afc5f1a2 100644 --- a/ui/commons/src/main/js/config/validators/CommonValidators.js +++ b/ui/commons/src/main/js/config/validators/CommonValidators.js @@ -20,7 +20,7 @@ define([ var obj = { "required": { "name": "Required field", - "dependencies": [ ], + "dependencies": [], "validator": function(el, input, callback) { var v = input.val(); if (!v || v === "") { @@ -33,7 +33,7 @@ define([ }, "passwordConfirm": { "name": "Password confirmation", - "dependencies": [ ], + "dependencies": [], "validator": function(el, input, callback) { var confirmValue = input.val(), mainInput = el.find(":input#" + input.attr("passwordField")); @@ -47,7 +47,7 @@ define([ }, "minLength": { "name": "Minimum number of characters", - "dependencies": [ ], + "dependencies": [], "validator": function(el, input, callback) { var v = input.val(), len = input.attr('minLength'); @@ -61,7 +61,7 @@ define([ }, "atLeastXNumbers": { "name": "Minimum occurrence of numeric characters in string", - "dependencies": [ ], + "dependencies": [], "validator": function(el, input, callback) { var v = input.val(), minNumbers = input.attr('atLeastXNumbers'), @@ -76,7 +76,7 @@ define([ }, "atLeastXCapitalLetters": { "name": "Minimum occurrence of capital letter characters in string", - "dependencies": [ ], + "dependencies": [], "validator": function(el, input, callback) { var v = input.val(), minCapitals = input.attr('atLeastXCapitalLetters'), diff --git a/ui/commons/src/main/js/org/forgerock/commons/ui/common/main/ProcessConfiguration.js b/ui/commons/src/main/js/org/forgerock/commons/ui/common/main/ProcessConfiguration.js index c3a5b66b4..3cf078b05 100644 --- a/ui/commons/src/main/js/org/forgerock/commons/ui/common/main/ProcessConfiguration.js +++ b/ui/commons/src/main/js/org/forgerock/commons/ui/common/main/ProcessConfiguration.js @@ -81,7 +81,8 @@ define([ if(service) { service[methodName].apply(service, params || []); } - }, function (exception) { + }, + function (exception) { if(params) { params = JSON.stringify(params); } diff --git a/ui/commons/src/test/qunit/AbstractCollection.js b/ui/commons/src/test/qunit/AbstractCollection.js index a30eda0a3..0644e2814 100644 --- a/ui/commons/src/test/qunit/AbstractCollection.js +++ b/ui/commons/src/test/qunit/AbstractCollection.js @@ -23,7 +23,7 @@ define([ ], function ($, sinon, AbstractCollection, ServiceInvoker) { QUnit.module('AbstractCollection Functions'); - QUnit.test("query operations", function () { + QUnit.test("query operations", function (assert) { var testCollection = new AbstractCollection(), restCallArg; @@ -58,16 +58,16 @@ define([ testCollection.setTotalPagedResultsPolicy("EXACT"); testCollection.getFirstPage().then(function () { - QUnit.equal(ServiceInvoker.restCall.callCount, 1, "Only one REST call produced"); + assert.equal(ServiceInvoker.restCall.callCount, 1, "Only one REST call produced"); restCallArg = ServiceInvoker.restCall.args[0][0]; // first invocation, first argument - QUnit.equal(testCollection.length, 2, "collection contains two records from the backend"); - QUnit.equal(testCollection.where({givenName: "Boaty"}).length, 1, + assert.equal(testCollection.length, 2, "collection contains two records from the backend"); + assert.equal(testCollection.where({givenName: "Boaty"}).length, 1, "able to find expected model content in collection"); - QUnit.ok(testCollection.hasNext(), "response with cookie indicates that hasNext is true"); - QUnit.equal(testCollection.state.totalRecords, 5, "Total records correctly populated in collection state"); - QUnit.equal(testCollection.state.totalPages, 3, "Total pages correctly populated in collection state"); - QUnit.equal(restCallArg.url, "/crestResource", "correct url used to query backend"); - QUnit.equal(restCallArg.data, + assert.ok(testCollection.hasNext(), "response with cookie indicates that hasNext is true"); + assert.equal(testCollection.state.totalRecords, 5, "Total records correctly populated in collection state"); + assert.equal(testCollection.state.totalPages, 3, "Total pages correctly populated in collection state"); + assert.equal(restCallArg.url, "/crestResource", "correct url used to query backend"); + assert.equal(restCallArg.data, "_queryFilter=true&_pageSize=2&_sortKeys=givenName&_totalPagedResultsPolicy=EXACT", "correct data submitted to backend for first page"); }).then(function () { @@ -75,14 +75,14 @@ define([ return testCollection.getFirstPage(); }).then(function () { restCallArg = ServiceInvoker.restCall.args[1][0]; // second invocation, first argument - QUnit.equal(restCallArg.data, + assert.equal(restCallArg.data, "_queryFilter=true&_pageSize=2&_sortKeys=-givenName&_totalPagedResultsPolicy=EXACT", "correct data submitted to backend for descending sortKey"); }).then(function () { return testCollection.getNextPage(); }).then(function () { restCallArg = ServiceInvoker.restCall.args[2][0]; // third invocation, first argument - QUnit.equal(restCallArg.data, + assert.equal(restCallArg.data, "_queryFilter=true&_pageSize=2&_sortKeys=-givenName"+ "&_totalPagedResultsPolicy=EXACT&_pagedResultsCookie=2", "correct data submitted to backend for next page"); diff --git a/ui/commons/src/test/qunit/AbstractModel.js b/ui/commons/src/test/qunit/AbstractModel.js index fc0bd2db7..8c1b77932 100644 --- a/ui/commons/src/test/qunit/AbstractModel.js +++ b/ui/commons/src/test/qunit/AbstractModel.js @@ -22,7 +22,7 @@ define([ ], function ($, sinon, AbstractModel, ServiceInvoker) { QUnit.module('AbstractModel Functions'); - QUnit.test("create with server-assigned id", function () { + QUnit.test("create with server-assigned id", function (assert) { var testModel = new AbstractModel(), newRecord = { "foo": "bar", @@ -41,15 +41,15 @@ define([ testModel.save(newRecord).then(function () { restCallArg = ServiceInvoker.restCall.args[0][0]; // first invocation, first argument - QUnit.equal(testModel.id, 1, "Newly-created model has id from backend"); - QUnit.equal(restCallArg.url, "/crestResource?_action=create&", "correct url used to create model"); - QUnit.equal(restCallArg.type, "POST", "correct method used to create model"); + assert.equal(testModel.id, 1, "Newly-created model has id from backend"); + assert.equal(restCallArg.url, "/crestResource?_action=create&", "correct url used to create model"); + assert.equal(restCallArg.type, "POST", "correct method used to create model"); ServiceInvoker.restCall.restore(); }); }); - QUnit.test("create with client-supplied id", function () { + QUnit.test("create with client-supplied id", function (assert) { var testModel = new AbstractModel(), newRecord = { "foo": "bar", @@ -68,16 +68,16 @@ define([ testModel.save(newRecord).then(function () { restCallArg = ServiceInvoker.restCall.args[0][0]; // first invocation, first argument - QUnit.equal(testModel.get("_rev"), 1, "Model has new rev from backend"); - QUnit.equal(restCallArg.url, "/crestResource/myCustomId?", "correct url used to create model"); - QUnit.equal(restCallArg.headers["If-None-Match"], "*", "correct revision header provided"); - QUnit.equal(restCallArg.type, "PUT", "correct method used to create model"); + assert.equal(testModel.get("_rev"), 1, "Model has new rev from backend"); + assert.equal(restCallArg.url, "/crestResource/myCustomId?", "correct url used to create model"); + assert.equal(restCallArg.headers["If-None-Match"], "*", "correct revision header provided"); + assert.equal(restCallArg.type, "PUT", "correct method used to create model"); ServiceInvoker.restCall.restore(); }) }); - QUnit.test("read operation", function () { + QUnit.test("read operation", function (assert) { var testModel = new AbstractModel(), restCallArg; @@ -94,10 +94,10 @@ define([ testModel.fetch().then(function () { restCallArg = ServiceInvoker.restCall.args[0][0]; // first invocation, first argument - QUnit.equal(testModel.get("name"), "foo", "example data populated from fetch call"); - QUnit.equal(testModel.get("_rev"), 1, "revision populated from fetch call"); - QUnit.equal(restCallArg.url, "/crestResource/1?", "correct url used to read model"); - QUnit.equal(restCallArg.type, "GET", "correct method used to read model"); + assert.equal(testModel.get("name"), "foo", "example data populated from fetch call"); + assert.equal(testModel.get("_rev"), 1, "revision populated from fetch call"); + assert.equal(restCallArg.url, "/crestResource/1?", "correct url used to read model"); + assert.equal(restCallArg.type, "GET", "correct method used to read model"); }).then(function () { testModel.additionalParameters = { "_fields": "name" @@ -105,19 +105,19 @@ define([ return testModel.fetch(); }).then(function () { restCallArg = ServiceInvoker.restCall.args[1][0]; // second invocation, first argument - QUnit.equal(restCallArg.url, "/crestResource/1?_fields=name", "url includes additionalParameters"); + assert.equal(restCallArg.url, "/crestResource/1?_fields=name", "url includes additionalParameters"); }).then(function () { testModel.parse = function (response) { return _.extend({"addedByParseFunction": true}, response); }; return testModel.fetch(); }).then(function () { - QUnit.equal(testModel.get("addedByParseFunction"), true, "parse function successfully modified model content"); + assert.equal(testModel.get("addedByParseFunction"), true, "parse function successfully modified model content"); ServiceInvoker.restCall.restore(); }); }); - QUnit.test("update operations", function () { + QUnit.test("update operations", function (assert) { var testModel = new AbstractModel({ "_id": 1, "_rev": 1, @@ -136,16 +136,16 @@ define([ testModel.save().then(function () { restCallArg = ServiceInvoker.restCall.args[0][0]; // first invocation, first argument - QUnit.equal(testModel.get("_rev"), 2, "Model has new rev from backend"); - QUnit.equal(restCallArg.url, "/crestResource/1?", "correct url used to update model"); - QUnit.equal(restCallArg.headers["If-Match"], 1, "correct revision header provided"); - QUnit.equal(restCallArg.type, "PUT", "correct method used to update model"); + assert.equal(testModel.get("_rev"), 2, "Model has new rev from backend"); + assert.equal(restCallArg.url, "/crestResource/1?", "correct url used to update model"); + assert.equal(restCallArg.headers["If-Match"], 1, "correct revision header provided"); + assert.equal(restCallArg.type, "PUT", "correct method used to update model"); ServiceInvoker.restCall.restore(); }); }); - QUnit.test("delete operations", function () { + QUnit.test("delete operations", function (assert) { var testModel = new AbstractModel({ "_id": 1, "_rev": 1, @@ -162,14 +162,14 @@ define([ testModel.destroy().then(function () { restCallArg = ServiceInvoker.restCall.args[0][0]; // first invocation, first argument - QUnit.equal(restCallArg.url, "/crestResource/1?", "correct url used to delete model"); - QUnit.equal(restCallArg.type, "DELETE", "correct method used to DELETE model"); + assert.equal(restCallArg.url, "/crestResource/1?", "correct url used to delete model"); + assert.equal(restCallArg.type, "DELETE", "correct method used to DELETE model"); ServiceInvoker.restCall.restore(); }); }); - QUnit.test("patch operations", function () { + QUnit.test("patch operations", function (assert) { var testModel = new AbstractModel({ "_id": 1, "_rev": 1, @@ -187,15 +187,15 @@ define([ testModel.save({"foo": "baz"}, {patch: true}).then(function () { restCallArg = ServiceInvoker.restCall.args[0][0]; // first invocation, first argument - QUnit.equal(restCallArg.url, "/crestResource/1?", "correct url used to patch model"); - QUnit.equal(restCallArg.type, "PATCH", "correct method used to patch model"); - QUnit.equal(restCallArg.data, '[{"operation":"replace","field":"/foo","value":"baz"}]', "correct patch content provided"); + assert.equal(restCallArg.url, "/crestResource/1?", "correct url used to patch model"); + assert.equal(restCallArg.type, "PATCH", "correct method used to patch model"); + assert.equal(restCallArg.data, '[{"operation":"replace","field":"/foo","value":"baz"}]', "correct patch content provided"); ServiceInvoker.restCall.restore(); }); }); - QUnit.test("custom get method to support JSONPointer", function () { + QUnit.test("custom get method to support JSONPointer", function (assert) { var testModel = new AbstractModel({ "_id": 1, "_rev": 1, @@ -204,9 +204,9 @@ define([ "hello": "world" } }); - QUnit.equal(testModel.get("simpleKey"), "simpleValue", "basic get behavior used to get simple value"); - QUnit.equal(testModel.get("/simpleKey"), "simpleValue", "jsonpointer used to get simple value"); - QUnit.equal(testModel.get("/foo/hello"), "world", "jsonpointer used to get deeply-nested value"); + assert.equal(testModel.get("simpleKey"), "simpleValue", "basic get behavior used to get simple value"); + assert.equal(testModel.get("/simpleKey"), "simpleValue", "jsonpointer used to get simple value"); + assert.equal(testModel.get("/foo/hello"), "world", "jsonpointer used to get deeply-nested value"); }) }); diff --git a/ui/commons/src/test/qunit/Base64.js b/ui/commons/src/test/qunit/Base64.js index 7bfc3e8b0..944dec84a 100644 --- a/ui/commons/src/test/qunit/Base64.js +++ b/ui/commons/src/test/qunit/Base64.js @@ -20,56 +20,56 @@ define([ ], function (Base64, Mime) { QUnit.module('Base64 Functions'); - QUnit.test("Base64.encodeUTF8", function () { + QUnit.test("Base64.encodeUTF8", function (assert) { var input = "パスワードパスワード"; - QUnit.strictEqual(Base64.encodeUTF8(input), "44OR44K544Ov44O844OJ44OR44K544Ov44O844OJ", + assert.strictEqual(Base64.encodeUTF8(input), "44OR44K544Ov44O844OJ44OR44K544Ov44O844OJ", "Incorrect base-64 encoding"); }); - QUnit.test("Base64.encodeUTF8 - 2 pad chars", function() { + QUnit.test("Base64.encodeUTF8 - 2 pad chars", function(assert) { var input = "パスワードパスワードx"; - QUnit.strictEqual(Base64.encodeUTF8(input), "44OR44K544Ov44O844OJ44OR44K544Ov44O844OJeA==", + assert.strictEqual(Base64.encodeUTF8(input), "44OR44K544Ov44O844OJ44OR44K544Ov44O844OJeA==", "Incorrect base-64 encoding - 2 pad char case"); }); - QUnit.test("Base64.encodeUTF8 - 1 pad char", function() { + QUnit.test("Base64.encodeUTF8 - 1 pad char", function(assert) { var input = "パスワードパスワードxx"; - QUnit.strictEqual(Base64.encodeUTF8(input), "44OR44K544Ov44O844OJ44OR44K544Ov44O844OJeHg=", + assert.strictEqual(Base64.encodeUTF8(input), "44OR44K544Ov44O844OJ44OR44K544Ov44O844OJeHg=", "Incorrect base-64 encoding - 1 pad char case"); }); - QUnit.test("Base64.decodeUTF8", function() { + QUnit.test("Base64.decodeUTF8", function(assert) { var input = "44OR44K544Ov44O844OJ44OR44K544Ov44O844OJ"; - QUnit.strictEqual(Base64.decodeUTF8(input), "パスワードパスワード", + assert.strictEqual(Base64.decodeUTF8(input), "パスワードパスワード", "Incorrect base-64 decoding"); }); - QUnit.test("Base64.decodeUTF8 - 1 pad char", function() { + QUnit.test("Base64.decodeUTF8 - 1 pad char", function(assert) { var input = "44OR44K544Ov44O844OJ44OR44K544Ov44O844OJeHg="; - QUnit.strictEqual(Base64.decodeUTF8(input), "パスワードパスワードxx", + assert.strictEqual(Base64.decodeUTF8(input), "パスワードパスワードxx", "Incorrect base-64 decoding"); }); - QUnit.test("Base64.decodeUTF8 - 2 pad chars", function() { + QUnit.test("Base64.decodeUTF8 - 2 pad chars", function(assert) { var input = "44OR44K544Ov44O844OJ44OR44K544Ov44O844OJeA=="; - QUnit.strictEqual(Base64.decodeUTF8(input), "パスワードパスワードx", + assert.strictEqual(Base64.decodeUTF8(input), "パスワードパスワードx", "Incorrect base-64 decoding"); }); - QUnit.test("Base64.encodeUTF8/decodeUTF8 - various punctuation characters", function() { + QUnit.test("Base64.encodeUTF8/decodeUTF8 - various punctuation characters", function(assert) { var input = "43uin 98e2 + 343_ {} 43qafdgfREER\'FDj ionk/.,<>`fj iod Hdfjl"; - QUnit.strictEqual(Base64.decodeUTF8(Base64.encodeUTF8(input)), input, + assert.strictEqual(Base64.decodeUTF8(Base64.encodeUTF8(input)), input, "Unable to round-trip Base64 special characters"); }); - QUnit.test("Mime.encodeHeader", function() { + QUnit.test("Mime.encodeHeader", function(assert) { var input = "パスワードパスワード"; - QUnit.strictEqual(Mime.encodeHeader(input), "=?UTF-8?B?44OR44K544Ov44O844OJ44OR44K544Ov44O844OJ?=", + assert.strictEqual(Mime.encodeHeader(input), "=?UTF-8?B?44OR44K544Ov44O844OJ44OR44K544Ov44O844OJ?=", "Incorrect Mime encoding in header"); }); }); diff --git a/ui/commons/src/test/qunit/OAuth.js b/ui/commons/src/test/qunit/OAuth.js index 9b4cbe015..142d0c3c4 100644 --- a/ui/commons/src/test/qunit/OAuth.js +++ b/ui/commons/src/test/qunit/OAuth.js @@ -35,19 +35,19 @@ define([ URIUtils.getCurrentPathName.restore(); }); - QUnit.test("oAuth redirect uri", function () { - QUnit.equal(OAuth.getRedirectURI(),"http://rp.com/app/oauthReturn.html", + QUnit.test("oAuth redirect uri", function (assert) { + assert.equal(OAuth.getRedirectURI(),"http://rp.com/app/oauthReturn.html", "default oAuth redirect_uri matches" ); - QUnit.equal(OAuth.getRedirectURI('customOAuthReturn.html'),"http://rp.com/app/customOAuthReturn.html", + assert.equal(OAuth.getRedirectURI('customOAuthReturn.html'),"http://rp.com/app/customOAuthReturn.html", "custom oAuth redirect_uri matches" ); }); - QUnit.test("oAuth request url", function () { + QUnit.test("oAuth request url", function (assert) { sinon.stub(OAuth, "generateNonce", function () { return "nonceValue"; }); - QUnit.equal(OAuth.getRequestURL( + assert.equal(OAuth.getRequestURL( "http://idp.com/request", "myClientId", "openid profile email", diff --git a/ui/commons/src/test/qunit/ObjectUtil.js b/ui/commons/src/test/qunit/ObjectUtil.js index b35582644..65ad6bac0 100644 --- a/ui/commons/src/test/qunit/ObjectUtil.js +++ b/ui/commons/src/test/qunit/ObjectUtil.js @@ -22,75 +22,75 @@ define([ ], function (_, ObjectUtil) { QUnit.module('ObjectUtil Functions'); - QUnit.test("toJSONPointerMap", function () { + QUnit.test("toJSONPointerMap", function (assert) { var jsonMap = ObjectUtil.toJSONPointerMap({"c": 2, "a": {"b": ['x','y','z',true], "d": undefined }}); - QUnit.equal(jsonMap["/c"], '2', "toJSONPointerMap correctly flattens complex object"); - QUnit.ok(_.isEqual(jsonMap["/a/b"], ['x','y','z',true]), + assert.equal(jsonMap["/c"], '2', "toJSONPointerMap correctly flattens complex object"); + assert.ok(_.isEqual(jsonMap["/a/b"], ['x','y','z',true]), "toJSONPointerMap correctly returns a list when it encounters an array"); - QUnit.ok(!_.has(jsonMap, '/d'), "undefined value not included in map produced by toJSONPointerMap"); + assert.ok(!_.has(jsonMap, '/d'), "undefined value not included in map produced by toJSONPointerMap"); }); - QUnit.test("getValueFromPointer", function () { + QUnit.test("getValueFromPointer", function (assert) { var testObject = { testSet: ["apple", "pear"], testMap: {"foo":"bar", "hello": "world"} }; - QUnit.equal(ObjectUtil.getValueFromPointer(testObject, "/testMap/foo"), "bar", "/testMap/foo"); - QUnit.ok( + assert.equal(ObjectUtil.getValueFromPointer(testObject, "/testMap/foo"), "bar", "/testMap/foo"); + assert.ok( _.isEqual(ObjectUtil.getValueFromPointer(testObject, "/testSet"), ["apple", "pear"], "/testSet")); - QUnit.equal(ObjectUtil.getValueFromPointer(testObject, "/test2"), undefined, "/test2"); - QUnit.equal(ObjectUtil.getValueFromPointer(testObject, "/"), testObject, "/"); + assert.equal(ObjectUtil.getValueFromPointer(testObject, "/test2"), undefined, "/test2"); + assert.equal(ObjectUtil.getValueFromPointer(testObject, "/"), testObject, "/"); }); - QUnit.test("isEqualSet", function () { - QUnit.ok(ObjectUtil.isEqualSet([1], [1]), "Simple set equality"); - QUnit.ok(!ObjectUtil.isEqualSet([1], [1,3]), "Simple set inequality"); - QUnit.ok(ObjectUtil.isEqualSet([3,1], [1,3]), "Set equality regardless of order"); - QUnit.ok(ObjectUtil.isEqualSet([3,{a:1},1], [1,3,{a:1}]), "Set equality with complex items"); - QUnit.ok(!ObjectUtil.isEqualSet([3,{a:1},1], [1,3,{a:2}]), + QUnit.test("isEqualSet", function (assert) { + assert.ok(ObjectUtil.isEqualSet([1], [1]), "Simple set equality"); + assert.ok(!ObjectUtil.isEqualSet([1], [1,3]), "Simple set inequality"); + assert.ok(ObjectUtil.isEqualSet([3,1], [1,3]), "Set equality regardless of order"); + assert.ok(ObjectUtil.isEqualSet([3,{a:1},1], [1,3,{a:1}]), "Set equality with complex items"); + assert.ok(!ObjectUtil.isEqualSet([3,{a:1},1], [1,3,{a:2}]), "Set inequality with differing complex items"); - QUnit.ok(ObjectUtil.isEqualSet([3,{a:1},['b','a'],1], [1,3,{a:1},['a','b']]), + assert.ok(ObjectUtil.isEqualSet([3,{a:1},['b','a'],1], [1,3,{a:1},['a','b']]), "Set equality with complex objects, regardless of order, and with nested sets"); }); - QUnit.test("findItemsNotInSet", function () { - QUnit.ok(_.isEqual(ObjectUtil.findItemsNotInSet([1,2,3],[2,3]), [1]), "Simple difference found"); - QUnit.ok(_.isEqual(ObjectUtil.findItemsNotInSet([1,2,3],[2,3,1]), []), + QUnit.test("findItemsNotInSet", function (assert) { + assert.ok(_.isEqual(ObjectUtil.findItemsNotInSet([1,2,3],[2,3]), [1]), "Simple difference found"); + assert.ok(_.isEqual(ObjectUtil.findItemsNotInSet([1,2,3],[2,3,1]), []), "No differences found despite order differences"); - QUnit.ok(_.isEqual(ObjectUtil.findItemsNotInSet([1,{a:1},3],[3,1,{a:2}]), [{a:1}]), + assert.ok(_.isEqual(ObjectUtil.findItemsNotInSet([1,{a:1},3],[3,1,{a:2}]), [{a:1}]), "Complex item difference recognized"); - QUnit.ok(_.isEqual(ObjectUtil.findItemsNotInSet([1,{b:2,a:1},3],[3,1,{a:1,b:2}]), []), + assert.ok(_.isEqual(ObjectUtil.findItemsNotInSet([1,{b:2,a:1},3],[3,1,{a:1,b:2}]), []), "Complex item equality recognized, regardless of order"); }); - QUnit.test("walkDefinedPath", function () { + QUnit.test("walkDefinedPath", function (assert) { var testObject = {test:["apple", {"foo":"bar", "hello": "world"}]}; - QUnit.equal(ObjectUtil.walkDefinedPath(testObject, "/test/0"), "/test/0", "/test/0"); - QUnit.equal(ObjectUtil.walkDefinedPath(testObject, "/test/3/foo"), "/test/3", "/test/3/foo"); - QUnit.equal(ObjectUtil.walkDefinedPath(testObject, "/missing"), "/missing", "/missing"); - QUnit.equal(ObjectUtil.walkDefinedPath(testObject, "/missing/bar"), "/missing", "/missing/bar"); - QUnit.equal(ObjectUtil.walkDefinedPath({ } , "/foo"), "/foo", "/foo with empty object"); - QUnit.equal(ObjectUtil.walkDefinedPath({ foo: undefined } , "/foo"), + assert.equal(ObjectUtil.walkDefinedPath(testObject, "/test/0"), "/test/0", "/test/0"); + assert.equal(ObjectUtil.walkDefinedPath(testObject, "/test/3/foo"), "/test/3", "/test/3/foo"); + assert.equal(ObjectUtil.walkDefinedPath(testObject, "/missing"), "/missing", "/missing"); + assert.equal(ObjectUtil.walkDefinedPath(testObject, "/missing/bar"), "/missing", "/missing/bar"); + assert.equal(ObjectUtil.walkDefinedPath({ } , "/foo"), "/foo", "/foo with empty object"); + assert.equal(ObjectUtil.walkDefinedPath({ foo: undefined } , "/foo"), "/foo", "/foo as a property with undefined as the value"); - QUnit.equal(ObjectUtil.walkDefinedPath({ foo: null }, "/foo/bar"), + assert.equal(ObjectUtil.walkDefinedPath({ foo: null }, "/foo/bar"), "/foo", "/foo as a property with null as the value"); - QUnit.equal(ObjectUtil.walkDefinedPath({ foo: {bar:null} } , "/foo/bar"), + assert.equal(ObjectUtil.walkDefinedPath({ foo: {bar:null} } , "/foo/bar"), "/foo/bar", "/foo/bar as a property with null as the value"); }); - QUnit.test("generatePatchSet", function () { + QUnit.test("generatePatchSet", function (assert) { var patchDef = ObjectUtil.generatePatchSet({"a": 1, "b": 2}, {"a": 1}); - QUnit.ok(patchDef.length === 1 && patchDef[0].operation === "add" && + assert.ok(patchDef.length === 1 && patchDef[0].operation === "add" && patchDef[0].field === "/b" && patchDef[0].value === 2, "Simple field addition returned for patchDef"); patchDef = ObjectUtil.generatePatchSet({"a": 1, "b": 2}, {"c": 1}); - QUnit.equal(patchDef.length, 3, + assert.equal(patchDef.length, 3, "Expected operation count for removal of one attribute and addition of two others"); patchDef = ObjectUtil.generatePatchSet({ @@ -98,7 +98,7 @@ define([ }, { "setItems": [{"sub": 1}, {"sub": 2}] }); - QUnit.ok(patchDef.length === 1 && patchDef[0].operation === "remove" && + assert.ok(patchDef.length === 1 && patchDef[0].operation === "remove" && patchDef[0].field === "/setItems" && _.isEqual(patchDef[0].value, {"sub": 1}), "Removal of value from set based on value of item"); @@ -109,27 +109,27 @@ define([ "setItems": [{"sub": 3}, {"sub": 2}] }); - QUnit.ok(patchDef.length === 1 && patchDef[0].operation === "add" && + assert.ok(patchDef.length === 1 && patchDef[0].operation === "add" && patchDef[0].field === "/setItems/-" && _.isEqual(patchDef[0].value, {"sub": 4}), "Addition of value to set"); patchDef = ObjectUtil.generatePatchSet({manager:{_ref: "a/b/c"}},{}); - QUnit.ok(patchDef.length === 1 && patchDef[0].operation === "add" && + assert.ok(patchDef.length === 1 && patchDef[0].operation === "add" && patchDef[0].field === "/manager" && _.isEqual(patchDef[0].value, {_ref: "a/b/c"}), "Addition of whole new complex property results in full map added"); patchDef = ObjectUtil.generatePatchSet({manager:null},{manager:{_ref: "a/b/c"}}); - QUnit.ok(patchDef.length === 1 && patchDef[0].operation === "remove" && + assert.ok(patchDef.length === 1 && patchDef[0].operation === "remove" && patchDef[0].field === "/manager" && !patchDef[0].value, "Setting a complex property to null results in a remove operation on the whole object"); patchDef = ObjectUtil.generatePatchSet({manager:{_ref: "a/b/c"}},{manager:null}); - QUnit.ok(patchDef.length === 1 && patchDef[0].operation === "replace" && + assert.ok(patchDef.length === 1 && patchDef[0].operation === "replace" && patchDef[0].field === "/manager" && _.isEqual(patchDef[0].value, {_ref: "a/b/c"}), "Replacement of null value with whole new complex property results in full map added"); patchDef = ObjectUtil.generatePatchSet({manager:{_ref: "a/b/d"}},{manager:{_ref: "a/b/c"}}); - QUnit.ok(patchDef.length === 1 && patchDef[0].operation === "replace" && + assert.ok(patchDef.length === 1 && patchDef[0].operation === "replace" && patchDef[0].field === "/manager/_ref" && patchDef[0].value === "a/b/d", "Replacement of simple value in nested map"); }); diff --git a/ui/commons/src/test/qunit/Queue.js b/ui/commons/src/test/qunit/Queue.js index 0606952cf..3de51f9d4 100644 --- a/ui/commons/src/test/qunit/Queue.js +++ b/ui/commons/src/test/qunit/Queue.js @@ -19,16 +19,16 @@ define([ ], function (Queue) { QUnit.module('Queue Functions'); - QUnit.test("core operations", function () { + QUnit.test("core operations", function (assert) { var q = new Queue(["a","b"]); - QUnit.equal(q.peek(), "a"); - QUnit.equal(q.remove(), "a"); - QUnit.equal(q.remove(), "b"); + assert.equal(q.peek(), "a"); + assert.equal(q.remove(), "a"); + assert.equal(q.remove(), "b"); q.add("c"); - QUnit.equal(q.remove(), "c"); - QUnit.equal(q.peek(), undefined); - QUnit.equal(q.remove(), undefined); + assert.equal(q.remove(), "c"); + assert.equal(q.peek(), undefined); + assert.equal(q.remove(), undefined); }); diff --git a/ui/commons/src/test/qunit/Router.js b/ui/commons/src/test/qunit/Router.js index 00b13d01b..d639de040 100644 --- a/ui/commons/src/test/qunit/Router.js +++ b/ui/commons/src/test/qunit/Router.js @@ -19,16 +19,16 @@ define([ ], function (Router) { QUnit.module('Router Functions'); - QUnit.test("getLink", function () { + QUnit.test("getLink", function (assert) { var fakeRoute = { url: /fake-(.+)\-(.+)/, pattern: "fake-?-?" }; - QUnit.equal(Router.getLink(fakeRoute, ["simple", "value"]), "fake-simple-value"); - QUnit.equal(Router.getLink(fakeRoute, ["comp?lex", "value"]), "fake-comp?lex-value"); - QUnit.equal(Router.getLink(fakeRoute, ["part?ial"]), "fake-part?ial-"); - QUnit.equal(Router.getLink(fakeRoute, []), "fake--"); + assert.equal(Router.getLink(fakeRoute, ["simple", "value"]), "fake-simple-value"); + assert.equal(Router.getLink(fakeRoute, ["comp?lex", "value"]), "fake-comp?lex-value"); + assert.equal(Router.getLink(fakeRoute, ["part?ial"]), "fake-part?ial-"); + assert.equal(Router.getLink(fakeRoute, []), "fake--"); }); diff --git a/ui/commons/src/test/qunit/UIUtils.js b/ui/commons/src/test/qunit/UIUtils.js index 47d5118ca..39a48d3ca 100644 --- a/ui/commons/src/test/qunit/UIUtils.js +++ b/ui/commons/src/test/qunit/UIUtils.js @@ -21,7 +21,7 @@ define([ ], function (_, Handlebars, UIUtils) { QUnit.module('UIUtils Functions'); - QUnit.test("Static Select", function () { + QUnit.test("Static Select", function (assert) { var template = Handlebars.compile(""); var testHTML = template({"testVal": "2"}); - QUnit.equal($(testHTML).val(), "2", "2 option selected"); + assert.equal($(testHTML).val(), "2", "2 option selected"); testHTML = template({"testVal": "text/html"}); - QUnit.equal($(testHTML).val(), "text/html", "text/html option selected"); + assert.equal($(testHTML).val(), "text/html", "text/html option selected"); testHTML = template({"testVal": "tick'test"}); - QUnit.equal($(testHTML).val(), "tick'test", "tick'test option selected"); + assert.equal($(testHTML).val(), "tick'test", "tick'test option selected"); testHTML = template({"testVal": "less') $("#qunit-fixture").append(form); js2form(form[0], {testBool: true}); - QUnit.equal(form.find("[name=testBool]").prop("checked"), true); - QUnit.equal(form2js(form[0]).testBool, true); + assert.equal(form.find("[name=testBool]").prop("checked"), true); + assert.equal(form2js(form[0]).testBool, true); js2form(form[0], {testBool: false}); - QUnit.equal(form.find("[name=testBool]").prop("checked"), false); - QUnit.equal(form2js(form[0]).testBool, false); + assert.equal(form.find("[name=testBool]").prop("checked"), false); + assert.equal(form2js(form[0]).testBool, false); }); }); diff --git a/ui/mock/.eslintrc b/ui/mock/.eslintrc index 41b2d378d..abfa71ccb 100644 --- a/ui/mock/.eslintrc +++ b/ui/mock/.eslintrc @@ -1,6 +1,5 @@ { "root": true, - "extends": "forgerock", "env": { "amd": true, "browser": true diff --git a/ui/mock/Gruntfile.js b/ui/mock/Gruntfile.js index 7d3c8b95b..641e0aed7 100644 --- a/ui/mock/Gruntfile.js +++ b/ui/mock/Gruntfile.js @@ -27,17 +27,17 @@ module.exports = function (grunt) { testTargetDirectory = "target/test", sourceDirectory = "src/main/js", watchDirs = [ - "../forgerock-ui-commons/src/main/js", - "../forgerock-ui-commons/src/main/resources", - "../forgerock-ui-user/src/main/js", - "../forgerock-ui-user/src/main/resources", + "../commons/src/main/js", + "../commons/src/main/resources", + "../user/src/main/js", + "../user/src/main/resources", "src/main/js", "src/main/resources" ], testWatchDirs = { "src/test/qunit": "/", - "../forgerock-ui-commons/src/test/qunit": "/tests/commons/", - "../forgerock-ui-user/src/test/qunit": "/tests/user/" + "../commons/src/test/qunit": "/tests/commons/", + "../user/src/test/qunit": "/tests/user/" }; grunt.initConfig({ @@ -77,7 +77,18 @@ module.exports = function (grunt) { } }, qunit: { - all: [testTargetDirectory + "/index.html"] + all: [testTargetDirectory + "/index.html"], + options: { + timeout: 20000, + puppeteer: { + ignoreDefaultArgs: true, + args: [ + "--headless=new", + "--allow-file-access-from-files", + "--disable-dev-shm-usage" + ] + } + } }, requirejs: { /** diff --git a/ui/mock/package.json b/ui/mock/package.json index d523ca7b0..fada5e467 100644 --- a/ui/mock/package.json +++ b/ui/mock/package.json @@ -1,20 +1,19 @@ { - "name": "forgerock-ui-mock", - "description": "ForgeRock UI Demonstration", + "name": "ui-mock", + "description": "UI Demonstration", "private": true, "devDependencies": { "eslint": "4.18.2", - "eslint-config-forgerock": "^1.0.0", "eslint-formatter-warning-summary": "^1.0.1", "grunt": "1.5.3", "grunt-cli": "1.4.3", "grunt-contrib-less": "1.4.0", - "grunt-contrib-qunit": "0.4.0", - "grunt-contrib-requirejs": "0.4.4", - "grunt-contrib-watch": "0.6.1", + "grunt-contrib-qunit": "8.0.1", + "grunt-contrib-requirejs": "1.0.0", + "grunt-contrib-watch": "1.0.1", "grunt-eslint": "17.3.1", - "grunt-notify": "0.4.3", - "grunt-sync": "0.4.1", + "grunt-notify": "0.4.5", + "grunt-sync": "0.8.2", "less-plugin-clean-css": "1.5.1", "es5-ext": "0.10.53" } diff --git a/ui/mock/src/test/qunit/index.html b/ui/mock/src/test/qunit/index.html index a58b89061..2918b8026 100644 --- a/ui/mock/src/test/qunit/index.html +++ b/ui/mock/src/test/qunit/index.html @@ -5,7 +5,7 @@ ForgeRock UI - QUnit Tests - + @@ -24,9 +24,10 @@ - + + diff --git a/ui/mock/src/test/qunit/tests/main.js b/ui/mock/src/test/qunit/tests/main.js index a5f1cd1ab..a2cc04180 100644 --- a/ui/mock/src/test/qunit/tests/main.js +++ b/ui/mock/src/test/qunit/tests/main.js @@ -26,5 +26,5 @@ define([ "./commons/Router", "./commons/UIUtils", "./commons/ValidatorsManager", - "./user/AnonymousProcessView" + // "./user/AnonymousProcessView" ]); diff --git a/ui/pom.xml b/ui/pom.xml index 4802fe069..e266165da 100644 --- a/ui/pom.xml +++ b/ui/pom.xml @@ -157,7 +157,7 @@ org.openidentityplatform.commons.ui.libs qunit - 1.15.0 + 2.20.1 js https://cdnjs.cloudflare.com/ajax/libs/qunit/{version}/{artifactId}.{packaging} @@ -165,7 +165,7 @@ org.openidentityplatform.commons.ui.libs qunit css - 1.15.0 + 2.20.1 https://cdnjs.cloudflare.com/ajax/libs/qunit/{version}/{artifactId}.{packaging} @@ -514,7 +514,7 @@ com.github.eirslett frontend-maven-plugin - 1.7.6 + 1.15.0 ${node.install.directory} @@ -527,8 +527,7 @@ initialize v20.12.2 - 6.14.8 - + 10.5.0 @@ -548,7 +547,7 @@ compile - build --force + build @@ -812,7 +811,7 @@ org.openidentityplatform.commons.ui.libs qunit - 1.15.0 + 2.20.1 js test @@ -820,7 +819,7 @@ org.openidentityplatform.commons.ui.libs qunit css - 1.15.0 + 2.20.1 test diff --git a/ui/user/.eslintrc b/ui/user/.eslintrc index 329ec3dcf..1af13cee3 100644 --- a/ui/user/.eslintrc +++ b/ui/user/.eslintrc @@ -1,6 +1,5 @@ { "root": true, - "extends": "forgerock", "env": { "amd": true, "browser": true diff --git a/ui/user/package.json b/ui/user/package.json index ddd6ed2cc..c0f0f60a4 100644 --- a/ui/user/package.json +++ b/ui/user/package.json @@ -4,7 +4,6 @@ "private": true, "devDependencies": { "eslint": "4.18.2", - "eslint-config-forgerock": "^1.0.0", "eslint-formatter-warning-summary": "^1.0.1", "grunt": "1.5.3", "grunt-cli": "1.4.3",