mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Tweaks to the specs improvements from feedback
This commit is contained in:
@@ -103,7 +103,7 @@ describe('GitRepositoryAsync', () => {
|
||||
it('returns the repository path for a repository path', async () => {
|
||||
repo = openFixture('master.git')
|
||||
const repoPath = await repo.getPath()
|
||||
expect(repoPath).toBePath(path.join(__dirname, 'fixtures', 'git', 'master.git'))
|
||||
expect(repoPath).toEqualPath(path.join(__dirname, 'fixtures', 'git', 'master.git'))
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ describe "GitRepository", ->
|
||||
waitsForPromise ->
|
||||
repo.async.getPath().then(onSuccess)
|
||||
runs ->
|
||||
expect(onSuccess.mostRecentCall.args[0]).toBePath(repoPath)
|
||||
expect(onSuccess.mostRecentCall.args[0]).toEqualPath(repoPath)
|
||||
|
||||
describe "new GitRepository(path)", ->
|
||||
it "throws an exception when no repository is found", ->
|
||||
|
||||
@@ -207,7 +207,7 @@ addCustomMatchers = (spec) ->
|
||||
@message = -> return "Expected element '#{element}' or its descendants #{toOrNotTo} show."
|
||||
element.style.display in ['block', 'inline-block', 'static', 'fixed']
|
||||
|
||||
toBePath: (expected) ->
|
||||
toEqualPath: (expected) ->
|
||||
actualPath = path.normalize(@actual)
|
||||
expectedPath = path.normalize(expected)
|
||||
@message = -> return "Expected path '#{actualPath}' to be equal to '#{expectedPath}'."
|
||||
|
||||
@@ -4022,15 +4022,33 @@ describe('TextEditorComponent', function () {
|
||||
})
|
||||
})
|
||||
|
||||
describe('when changing the font', async function () {
|
||||
it('measures the default char, the korean char, the double width char and the half width char widths', async function () {
|
||||
expect(editor.getDefaultCharWidth()).toBeCloseTo(12, 0)
|
||||
describe('when decreasing the fontSize', async function () {
|
||||
it('decreases the widths of the korean char, the double width char and the half width char', async function () {
|
||||
originalDefaultCharWidth = editor.getDefaultCharWidth()
|
||||
koreanDefaultCharWidth = editor.getKoreanCharWidth()
|
||||
doubleWidthDefaultCharWidth = editor.getDoubleWidthCharWidth()
|
||||
halfWidthDefaultCharWidth = editor.getHalfWidthCharWidth()
|
||||
component.setFontSize(10)
|
||||
await nextViewUpdatePromise()
|
||||
expect(editor.getDefaultCharWidth()).toBeCloseTo(6, 0)
|
||||
expect(editor.getKoreanCharWidth()).toBeCloseTo(10, 0)
|
||||
expect(editor.getDoubleWidthCharWidth()).toBe(10)
|
||||
expect(editor.getHalfWidthCharWidth()).toBeCloseTo(6, 5)
|
||||
expect(editor.getDefaultCharWidth()).toBeLessThan(originalDefaultCharWidth)
|
||||
expect(editor.getKoreanCharWidth()).toBeLessThan(koreanDefaultCharWidth)
|
||||
expect(editor.getDoubleWidthCharWidth()).toBeLessThan(doubleWidthDefaultCharWidth)
|
||||
expect(editor.getHalfWidthCharWidth()).toBeLessThan(halfWidthDefaultCharWidth)
|
||||
})
|
||||
})
|
||||
|
||||
describe('when increasing the fontSize', function() {
|
||||
it('increases the widths of the korean char, the double width char and the half width char', async function () {
|
||||
originalDefaultCharWidth = editor.getDefaultCharWidth()
|
||||
koreanDefaultCharWidth = editor.getKoreanCharWidth()
|
||||
doubleWidthDefaultCharWidth = editor.getDoubleWidthCharWidth()
|
||||
halfWidthDefaultCharWidth = editor.getHalfWidthCharWidth()
|
||||
component.setFontSize(25)
|
||||
await nextViewUpdatePromise()
|
||||
expect(editor.getDefaultCharWidth()).toBeGreaterThan(originalDefaultCharWidth)
|
||||
expect(editor.getKoreanCharWidth()).toBeGreaterThan(koreanDefaultCharWidth)
|
||||
expect(editor.getDoubleWidthCharWidth()).toBeGreaterThan(doubleWidthDefaultCharWidth)
|
||||
expect(editor.getHalfWidthCharWidth()).toBeGreaterThan(halfWidthDefaultCharWidth)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ describe "atom.themes", ->
|
||||
expect(styleElementAddedHandler).toHaveBeenCalled()
|
||||
|
||||
element = document.querySelector('head style[source-path*="css.css"]')
|
||||
expect(element.getAttribute('source-path')).toBePath atom.themes.stringToId(cssPath)
|
||||
expect(element.getAttribute('source-path')).toEqualPath atom.themes.stringToId(cssPath)
|
||||
expect(element.textContent).toBe fs.readFileSync(cssPath, 'utf8')
|
||||
|
||||
# doesn't append twice
|
||||
@@ -194,7 +194,7 @@ describe "atom.themes", ->
|
||||
expect(document.querySelectorAll('head style').length).toBe lengthBefore + 1
|
||||
|
||||
element = document.querySelector('head style[source-path*="sample.less"]')
|
||||
expect(element.getAttribute('source-path')).toBePath atom.themes.stringToId(lessPath)
|
||||
expect(element.getAttribute('source-path')).toEqualPath atom.themes.stringToId(lessPath)
|
||||
expect(element.textContent).toBe """
|
||||
#header {
|
||||
color: #4d926f;
|
||||
@@ -213,9 +213,9 @@ describe "atom.themes", ->
|
||||
|
||||
it "supports requiring css and less stylesheets without an explicit extension", ->
|
||||
atom.themes.requireStylesheet path.join(__dirname, 'fixtures', 'css')
|
||||
expect(document.querySelector('head style[source-path*="css.css"]').getAttribute('source-path')).toBePath atom.themes.stringToId(atom.project.getDirectories()[0]?.resolve('css.css'))
|
||||
expect(document.querySelector('head style[source-path*="css.css"]').getAttribute('source-path')).toEqualPath atom.themes.stringToId(atom.project.getDirectories()[0]?.resolve('css.css'))
|
||||
atom.themes.requireStylesheet path.join(__dirname, 'fixtures', 'sample')
|
||||
expect(document.querySelector('head style[source-path*="sample.less"]').getAttribute('source-path')).toBePath atom.themes.stringToId(atom.project.getDirectories()[0]?.resolve('sample.less'))
|
||||
expect(document.querySelector('head style[source-path*="sample.less"]').getAttribute('source-path')).toEqualPath atom.themes.stringToId(atom.project.getDirectories()[0]?.resolve('sample.less'))
|
||||
|
||||
document.querySelector('head style[source-path*="css.css"]').remove()
|
||||
document.querySelector('head style[source-path*="sample.less"]').remove()
|
||||
|
||||
Reference in New Issue
Block a user