environment: Port environment.js to be an ES module

Removes the init() function in favor of executing all environment
changes when the file is imported.

Additionally ports all unit tests using imports.gi.environment.init() to
use the updated module.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2822>
This commit is contained in:
Evan Welsh
2023-07-09 23:05:14 -07:00
parent 26fa1046a3
commit 9a2c3da868
10 changed files with 125 additions and 134 deletions

View File

@ -1,12 +1,13 @@
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
// Test cases for Util.insertSorted
import * as Assertions from '../common/assertions.js';
// Needed so that Util can bring some UI stuff
// we don't actually use
const Environment = imports.ui.environment;
Environment.init();
import '../../js/ui/environment.js';
import * as Assertions from '../common/assertions.js';
const Util = imports.misc.util;
let arrayInt = [1, 2, 3, 5, 6];