Fix of the spec *and rollback of a useless change*

This commit is contained in:
Trigan2025 2023-10-21 13:19:43 +02:00
parent 05ec5a7c26
commit 68843f3c6d
3 changed files with 7 additions and 9 deletions

View File

@ -17,7 +17,7 @@ module.exports = class WrapGuideElement {
this.setWhen(when);
this.element.updateGuide = (async () => await this.updateGuide()).bind(this);
this.element.getDefaultColumn = (async () => await this.getDefaultColumn()).bind(this);
this.element.getDefaultColumn = this.getDefaultColumn.bind(this);
}
get shouldShow() { return this.#_shouldShow; }

View File

@ -58,13 +58,10 @@ describe("WrapGuideElement", function() {
});
it("positions the guide at the configured column", function() {
// const width = editor.getDefaultCharWidth() * wrapGuide.getDefaultColumn();
waitsForPromise(() => wrapGuide.getDefaultColumn().then((column) => {
const width = column * editor.getDefaultCharWidth();
expect(width).toBeGreaterThan(0);
expect(Math.abs(getLeftPosition(wrapGuide.firstChild) - width)).toBeLessThan(1);
expect(wrapGuide).toBeVisible();
}));
const width = editor.getDefaultCharWidth() * wrapGuide.getDefaultColumn();
expect(width).toBeGreaterThan(0);
expect(Math.abs(getLeftPosition(wrapGuide.firstChild) - width)).toBeLessThan(1);
expect(wrapGuide).toBeVisible();
});
it("appends multiple wrap guides to all existing and new editors", function() {
@ -311,7 +308,7 @@ describe("WrapGuideElement", function() {
it('::getDefaultColumn returns the scope-specific column value', function() {
atom.config.set('editor.preferredLineLength', 132, {scopeSelector: '.source.js'});
waitsForPromise(() => wrapGuide.getDefaultColumn().then((column) => expect(column).toBe(132)));
expect(wrapGuide.getDefaultColumn()).toBe(132);
});
it('updates the guide when the scope-specific column changes', function() {

View File

@ -7,6 +7,7 @@ describe('Wrap Guide', () => {
beforeEach(async () => {
await atom.packages.activatePackage('wrap-guide')
atom.config.set('wrap-guide.showWrapGuide', 'always')
editor = await atom.workspace.open('sample.js')
editorElement = editor.getElement()