<commit_before>'use strict';

const { Application } = require('spectron');
const { assert } = require('chai');

const APP_PATH = './dist/Negative-darwin-x64/Negative.app/Contents/MacOS/Negative';

describe('View > Dark Mode', function () {
	const app = new Application({
		path: APP_PATH,
		env: {
			ELECTRON_ENABLE_LOGGING: true,
			ELECTRON_ENABLE_STACK_DUMPING: true,
			NEGATIVE_IGNORE_SETTINGS: true,
			NEGATIVE_SKIP_RESET_DIALOG: true,
			NODE_ENV: 'development'
		}
	});
	
	this.timeout(60000);
	
	beforeEach(() => {
		return app.start();
	});

	afterEach(() => {
		if (app && app.isRunning()) {
			return app.stop();
		}
	});
	
	it('Should toggle dark mode', () => {
		return app.client.waitUntilWindowLoaded()
			.then(() => {
				return app.client.selectorExecute('//body', (elements) => {
					return elements[0].classList.contains('light-mode');
				});
			})
			.then((hasNoTipsClass) => assert.isFalse(hasNoTipsClass, 'The body element should not have the .light-mode class when on startup.'))
			.then(() => app.electron.ipcRenderer.send('test-dark-mode'))
			.then(() => {
				return app.client.selectorExecute('//body', (elements) => {
					return elements[0].classList.contains('light-mode');
				});
			})<commit_msg>Fix dark mode test<commit_after>'use strict';

const { Application } = require('spectron');
const { assert } = require('chai');

const APP_PATH = './dist/Negative-darwin-x64/Negative.app/Contents/MacOS/Negative';

describe('View > Dark Mode', function () {
	const app = new Application({
		path: APP_PATH,
		env: {
			ELECTRON_ENABLE_LOGGING: true,
			ELECTRON_ENABLE_STACK_DUMPING: true,
			NEGATIVE_IGNORE_SETTINGS: true,
			NEGATIVE_SKIP_RESET_DIALOG: true,
			NODE_ENV: 'development'
		}
	});
	
	this.timeout(60000);
	
	beforeEach(() => {
		return app.start();
	});

	afterEach(() => {
		if (app && app.isRunning()) {
			return app.stop();
		}
	});
	
	it('Should toggle dark mode', () => {
		return app.client.waitUntilWindowLoaded()
			.then(() => {
				return app.client.selectorExecute('//body', (elements) => {
					return elements[0].classList.contains('light-mode');
				});
			})
			.then((hasNoTipsClass) => assert.isFalse(hasNoTipsClass, 'The body element should not have the .light-mode class when on startup.'))
			.then(() => app.electron.ipcRenderer.send('test-dark-mode'))
			.then(() => {
				return app.client.waitUntil(() => {
					return app.client.selectorExecute('//body', (elements) => {
						return elements[0].classList.contains('light-mode');
					});
				});
			})
{'fraction_non_alphanumeric': 0.17812006319115323, 'fraction_numerical': 0.0071090047393364926, 'mean_word_length': 3.8155893536121672, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6699094', 'n_tokens_mistral': 998, 'n_tokens_neox': 844, 'n_words': 157}