From e4658e8023e4243507e71a0a53f1761efa3b102e Mon Sep 17 00:00:00 2001 From: Lisa P Date: Wed, 2 Dec 2015 17:34:46 +0100 Subject: [PATCH] fix tests and stuff --- app/styles/app/modules/notice.sass | 6 +++--- tests/unit/components/builds-item-test.coffee | 8 ++++---- tests/unit/components/caches-item-test.coffee | 6 +++--- .../components/job-repo-actions-test.coffee | 4 ++-- tests/unit/components/jobs-item-test.coffee | 12 +++++------ tests/unit/components/jobs-list-test.coffee | 10 +++++----- .../unit/components/requests-item-test.coffee | 20 ++++++++----------- 7 files changed, 31 insertions(+), 35 deletions(-) diff --git a/app/styles/app/modules/notice.sass b/app/styles/app/modules/notice.sass index 0dee2bda..5d009316 100644 --- a/app/styles/app/modules/notice.sass +++ b/app/styles/app/modules/notice.sass @@ -4,7 +4,7 @@ background-color: #F9F3D3 color: #AF9112 border-radius: 2px - font-size: 14px + font-size: 15px a color: #AF9112 text-decoration: underline @@ -26,14 +26,14 @@ background-color: #d2f5f9 color: #40a3ad border-radius: 2px - font-size: 14px + font-size: 15px a color: #40a3ad text-decoration: underline .icon-flag display: inline-block - @extend %icon-line-flag-blue + @extend %icon-line-flag-teal display: inline-block background: color: #40a3ad diff --git a/tests/unit/components/builds-item-test.coffee b/tests/unit/components/builds-item-test.coffee index b4496a79..eb1bbbee 100644 --- a/tests/unit/components/builds-item-test.coffee +++ b/tests/unit/components/builds-item-test.coffee @@ -2,7 +2,7 @@ moduleForComponent 'builds-item', { needs: ['helper:format-sha', 'helper:format-duration', 'helper:format-time', - 'helper:format-message', 'helper:pretty-date'] + 'helper:format-message', 'helper:pretty-date', 'component:status-icon', 'component:request-icon'] } test 'it renders', (assert) -> @@ -31,6 +31,6 @@ test 'it renders', (assert) -> @append() ok component.$().hasClass('passed'), 'component has right status class' - equal component.$('.tile-main h2 small').text(), 'foobarbranch', 'component renders branch if event is push' - equal component.$('.tile-author img').attr('src'), 'https://www.gravatar.com/avatar/5c1e6d6e64e12aca17657581a48005d1?s=40&d=https%3A%2F%2Ftravis-ci.org%2Fimages%2Fui%2Fdefault-avatar.png', 'component renders right gravatar image' - equal component.$('.build-status + p a').attr('href'), 'https://github.com/foo/bar/commit/a5e8093098f9c0fb46856b753fb8943c7fbf26f3', 'component generates right commit link' + equal component.$('.row-branch a').text().trim(), 'foobarbranch', 'component renders branch if event is push' + equal component.$('.avatar').attr('src'), 'https://www.gravatar.com/avatar/5c1e6d6e64e12aca17657581a48005d1?s=40&d=https%3A%2F%2Ftravis-ci.org%2Fimages%2Fui%2Fdefault-avatar.png', 'component renders right gravatar image' + equal component.$('a[title="See the commit on GitHub"]').attr('href'), 'https://github.com/foo/bar/commit/a5e8093098f9c0fb46856b753fb8943c7fbf26f3', 'component generates right commit link' diff --git a/tests/unit/components/caches-item-test.coffee b/tests/unit/components/caches-item-test.coffee index 9ac7e57c..fffce6f6 100644 --- a/tests/unit/components/caches-item-test.coffee +++ b/tests/unit/components/caches-item-test.coffee @@ -1,7 +1,7 @@ `import { test, moduleForComponent } from 'ember-qunit'` moduleForComponent 'caches-item', 'CachesItemComponent', { - needs: ['helper:format-time', 'helper:travis-mb'] + needs: ['helper:format-time', 'helper:travis-mb', 'component:request-icon'] } test 'it renders', -> @@ -18,6 +18,6 @@ test 'it renders', -> @append() ok component.$().hasClass('push'), 'component should have a type class (push)' - equal component.$('.caches-branch').text().trim(), 'master', 'branch name should be displayed' + equal component.$('.row-item:first-child .label-align').text().trim(), 'master', 'branch name should be displayed' # equal component.$('.caches-date').text().trim(), '', '' - equal component.$('.caches-size').text().trim(), '1.00MB', 'size should be displayed' + equal component.$('.row-item:nth-child(3) .label-align').text().trim(), '1.00MB', 'size should be displayed' diff --git a/tests/unit/components/job-repo-actions-test.coffee b/tests/unit/components/job-repo-actions-test.coffee index e5ff256f..7a75e973 100644 --- a/tests/unit/components/job-repo-actions-test.coffee +++ b/tests/unit/components/job-repo-actions-test.coffee @@ -7,13 +7,13 @@ test 'it shows cancel button if canCancel is true', -> component = @subject(canCancel: true) @append() - ok component.$('a[title="Cancel Job"]').length, 'cancel link should be visible' + ok component.$('a[title="Cancel job"]').length, 'cancel link should be visible' test 'it shows restart button if canRestart is true', -> component = @subject(canRestart: true) @append() - ok component.$('a[title="Restart Job"]').length, 'restart link should be visible' + ok component.$('a[title="Restart job"]').length, 'restart link should be visible' test 'user can cancel if she has permissions to a repo and job is cancelable', -> job = Ember.Object.create(canCancel: false, userHasPermissionForRepo: true) diff --git a/tests/unit/components/jobs-item-test.coffee b/tests/unit/components/jobs-item-test.coffee index b0392242..651b9201 100644 --- a/tests/unit/components/jobs-item-test.coffee +++ b/tests/unit/components/jobs-item-test.coffee @@ -2,7 +2,7 @@ moduleForComponent 'jobs-item', 'JobsItemComponent', { # specify the other units that are required for this test - needs: ['helper:format-duration', 'helper:pretty-date'] + needs: ['helper:format-duration', 'helper:pretty-date', 'component:status-icon'] } test 'it renders', -> @@ -23,7 +23,7 @@ test 'it renders', -> @append() ok component.$().hasClass('passed'), 'component should have a state class (passed)' - equal component.$('.job-id').text().trim(), '2', 'job number should be displayed' + equal component.$('.job-number').text().trim(), '2', 'job number should be displayed' equal component.$('.job-lang').text().trim(), 'JDK: openjdk6 Ruby: 2.1.2', 'langauges list should be displayed' equal component.$('.job-env').text().trim(), 'TESTS=unit', 'env should be displayed' ok component.$('.job-os').hasClass('linux'), 'OS class should be added for OS icon' @@ -53,8 +53,8 @@ test 'when env is not set, gemfile is displayed in the env section', -> component = @subject(job: job) @append() - equal component.$('.job-lang').text().trim(), 'Ruby: 2.1.2', 'langauges list should be displayed' - equal component.$('.job-env').text().trim(), 'Gemfile: foo/Gemfile', 'env should be displayed' + equal component.$('.job-lang .label-align').text().trim(), 'Ruby: 2.1.2', 'langauges list should be displayed' + equal component.$('.job-env .label-align').text().trim(), 'Gemfile: foo/Gemfile', 'env should be displayed' test 'when env is set, gemfile is displayed in the language section', -> attributes = { @@ -72,5 +72,5 @@ test 'when env is set, gemfile is displayed in the language section', -> component = @subject(job: job) @append() - equal component.$('.job-lang').text().trim(), 'Ruby: 2.1.2 Gemfile: foo/Gemfile', 'Gemfile should be displayed in languages section' - equal component.$('.job-env').text().trim(), 'FOO=bar', 'env should be displayed' + equal component.$('.job-lang .label-align').text().trim(), 'Ruby: 2.1.2 Gemfile: foo/Gemfile', 'Gemfile should be displayed in languages section' + equal component.$('.job-env .label-align').text().trim(), 'FOO=bar', 'env should be displayed' diff --git a/tests/unit/components/jobs-list-test.coffee b/tests/unit/components/jobs-list-test.coffee index dece86b5..ee3871a0 100644 --- a/tests/unit/components/jobs-list-test.coffee +++ b/tests/unit/components/jobs-list-test.coffee @@ -11,10 +11,10 @@ test 'it renders a list of jobs', -> component = @subject(jobs: jobs, required: true) @append() - equal component.$('.build-title').text().trim(), 'Build Jobs' - equal component.$('.tile--jobs').length, 2, 'there should be 2 job items' - ok component.$('.tile--jobs:nth(0)').hasClass('passed'), 'passed class should be applied to a job' - ok component.$('.tile--jobs:nth(1)').hasClass('failed'), 'failed class should be applied to a job' + equal component.$('.section-title').text().trim(), 'Build Jobs' + equal component.$('.jobs-item').length, 2, 'there should be 2 job items' + ok component.$('.jobs-item:nth(0)').hasClass('passed'), 'passed class should be applied to a job' + ok component.$('.jobs-item:nth(1)').hasClass('failed'), 'failed class should be applied to a job' test 'it renders "Allowed Failures" version without a `required` property', -> jobs = [Ember.Object.create(id: 1)] @@ -22,4 +22,4 @@ test 'it renders "Allowed Failures" version without a `required` property', -> component = @subject(jobs: jobs) @append() - ok component.$('.build-title').text().match /Allowed Failures/ + ok component.$('.section-title').text().match /Allowed Failures/ diff --git a/tests/unit/components/requests-item-test.coffee b/tests/unit/components/requests-item-test.coffee index 985ccd18..48765fd3 100644 --- a/tests/unit/components/requests-item-test.coffee +++ b/tests/unit/components/requests-item-test.coffee @@ -1,7 +1,7 @@ `import { test, moduleForComponent } from 'ember-qunit'` moduleForComponent 'requests-item', { - needs: ['helper:format-message', 'helper:format-time', 'helper:github-commit-link'] + needs: ['helper:format-message', 'helper:format-time', 'helper:github-commit-link', 'component:status-icon', 'component:request-icon'] } test 'it renders request data', (assert) -> @@ -28,14 +28,12 @@ test 'it renders request data', (assert) -> component = @subject(request: request) @render() - assert.equal component.$('.requests-branch').text().trim().replace(/[\s]+/, ' '), - 'dev abcdef1' - assert.equal component.$('.requests-time').text().trim(), 'a day ago' - assert.ok component.$('.tile-status > .icon').hasClass('accepted'), 'icon should have accepted class' - assert.equal component.$('.requests-commit').text().trim(), 'Bam!' - assert.equal component.$('.requests-commit .emoji').length, 1, 'there should be an emoji icon in commit message' - assert.equal component.$('.requests-commit .emoji').attr('title'), ':bomb:' - assert.equal component.$('.requests-build a').text().trim(), '10', 'build number should be displayed' + assert.equal component.$('.row-item:nth-child(2) strong').text().trim(), 'dev' + assert.equal component.$('.row-item:nth-child(3) .label-align').text().trim(), 'a day ago' + assert.ok component.$('.status-icon').hasClass('accepted'), 'icon should have accepted class' + assert.equal component.$('.row-item:nth-child(4)').text().trim(), 'Bam!' + assert.equal component.$('.row-item:nth-child(4) .emoji').length, 1, 'there should be an emoji icon in commit message' + assert.equal component.$('.row-item:nth-child(5)').text().trim(), '10', 'build number should be displayed' test 'it renders PR number if a request is a PR', (assert) -> # creates the component instance @@ -43,11 +41,9 @@ test 'it renders PR number if a request is a PR', (assert) -> id: 1, isPullRequest: true, pullRequestNumber: 20, - build: null } component = @subject(request: request) @render() - assert.equal component.$('.requests-branch').text().trim(), '#20' - assert.equal component.$('.requests-build').text().trim(), '-' + assert.equal component.$('.row-item:nth-child(2) strong').text().trim(), '#20'