-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2260 from sweir27/artist-page-optimizations
@mzikherman => Only fetch cta_artists if the user is not logged in
- Loading branch information
Showing
4 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/desktop/components/artist_page_cta/test/template.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
_ = require 'underscore' | ||
$ = require 'cheerio' | ||
benv = require 'benv' | ||
jade = require 'jade' | ||
{ fabricate } = require 'antigravity' | ||
Artist = require '../../../models/artist' | ||
|
||
templates = | ||
overlay: jade.compileFile(require.resolve '../templates/overlay.jade') | ||
|
||
describe 'templates', -> | ||
before (done) -> | ||
benv.setup => | ||
@artist = new Artist fabricate 'artist', name: 'Seth Clark', cta_image: thumb: url: 'http://thumb.jpg' | ||
benv.expose | ||
sd: AP: 'http://test.test' | ||
done() | ||
|
||
after -> | ||
benv.teardown() | ||
|
||
describe 'when there are null cta artists', -> | ||
beforeEach -> | ||
@artist.set cta_artists: null | ||
@data = _.extend {}, { artist: @artist } | ||
|
||
it 'renders correctly', -> | ||
$template = $(templates.overlay @data) | ||
$template.find('.artist-page-cta-overlay__feed__items__row').length.should.equal 1 | ||
text = $template.find('.artist-page-cta-overlay__headline').text() | ||
text.should.equal 'Join Artsy to discover new works by Seth Clark and more artists you love' | ||
|
||
describe 'when there are null cta artists', -> | ||
beforeEach -> | ||
@artist.set cta_artists: [] | ||
@data = _.extend {}, { artist: @artist } | ||
|
||
it 'renders correctly', -> | ||
$template = $(templates.overlay @data) | ||
$template.find('.artist-page-cta-overlay__feed__items__row').length.should.equal 1 | ||
text = $template.find('.artist-page-cta-overlay__headline').text() | ||
text.should.equal 'Join Artsy to discover new works by Seth Clark and more artists you love' | ||
|
||
describe 'when there are some cta artists', -> | ||
beforeEach -> | ||
@artist.set cta_artists: [{ name: 'Drew Conrad', image: { thumb: { url: 'http://thumb1.jpg' } } }] | ||
@data = _.extend {}, { artist: @artist } | ||
|
||
it 'renders correctly', -> | ||
$template = $(templates.overlay @data) | ||
$template.find('.artist-page-cta-overlay__feed__items__row').length.should.equal 2 | ||
text = $($template.find('.artist-page-cta-overlay__feed__items__row__artist-info')[1]).text() | ||
text.should.equal '3 New WorksTodayDrew Conrad' |