Skip to content

Commit

Permalink
Updated formplayer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
orangejenny committed Jan 22, 2024
1 parent 41f499f commit 6ed39a7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ hqDefine("cloudcare/js/formplayer/spec/menu_list_spec", function () {
sinon.stub(Utils, 'getCurrentQueryInputs').callsFake(function () { return {}; });
});

after(function () {
hqImport("hqwebapp/js/initial_page_data").unregister("toggles_dict");
});

describe('#getMenuView', function () {
let FormplayerFrontend = hqImport("cloudcare/js/formplayer/app"),
server,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ hqDefine("cloudcare/js/formplayer/spec/query_spec", function () {
const QueryListView = hqImport("cloudcare/js/formplayer/menus/views/query");
const Utils = hqImport("cloudcare/js/formplayer/utils/utils");

hqImport("hqwebapp/js/initial_page_data").register("toggles_dict", { DYNAMICALLY_UPDATE_SEARCH_RESULTS: false });

const QueryViewModel = Backbone.Model.extend();
const QueryViewCollection = Backbone.Collection.extend();
const keyModel = new QueryViewModel({
Expand All @@ -34,6 +36,10 @@ hqDefine("cloudcare/js/formplayer/spec/query_spec", function () {
keyQueryView = new childViewConstructor({ parentView: keyQueryListView, model: keyModel});
});

after(function () {
hqImport("hqwebapp/js/initial_page_data").unregister("toggles_dict");
});

it('should create dictionary with either keys', function () {
const expectedKeyItemsetChoicesDict = { "CA": "California", "MA": "Massachusetts", "FL": "Florida"};
assert.deepEqual(expectedKeyItemsetChoicesDict, keyQueryView.model.get("itemsetChoicesDict"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ hqDefine("cloudcare/js/formplayer/spec/utils_spec", function () {
describe('CloudcareUrl', function () {
let stubs = {};

before(function () {
hqImport("hqwebapp/js/initial_page_data").register("toggles_dict", {
SPLIT_SCREEN_CASE_SEARCH: false,
DYNAMICALLY_UPDATE_SEARCH_RESULTS: false,
});
});

after(function () {
hqImport("hqwebapp/js/initial_page_data").unregister("toggles_dict");
});

beforeEach(function () {
let currentUrl = new Utils.CloudcareUrl({appId: 'abc123'});

Expand Down

0 comments on commit 6ed39a7

Please sign in to comment.