Chrome and Safari and the css display selector

164 views
Skip to first unread message

Mark Nijhof

unread,
Jun 14, 2010, 8:08:35 AM6/14/10
to js...@googlegroups.com
Hi,

Chrome and Safari seems to be having trouble with the
.css('display').should.be 'block' assertion. The result of
css('display') is an empty string for all occurrences. It works
perfectly in FireFox.

describe 'Animator - Displaying Big Cards when Frame is not visible'

before_each
cards = elements('<div id="cards"/>')
frame = elements('<div id="frame"/>')
animator = new Animator(cards, frame, '../')
end

describe 'bringInBigCards()'
it 'will display the cards placeholder using an animation'
animator.bringInBigCards()
Clock.tick(1000)
cards.css("display").should.be "block"
end
end

end

cards.css('display') return an empty string. What am I doing wrong?

-Mark


--
Mark Nijhof
Cre8ive Thought
m: 0047 95 00 99 37
e: mark....@cre8ivethought.com
w: www.cre8ivethought.com

Mark Nijhof

unread,
Jun 14, 2010, 8:26:32 AM6/14/10
to js...@googlegroups.com
Ok I replaced the display stuff with be_visible and be_hidden the
be_visible works in all browsers, but the be_hidden does only work in
FF

be_visible : function(actual) {
return jQuery(actual).css('display') != 'none' &&
jQuery(actual).css('visibility') != 'hidden' &&
jQuery(actual).attr('type') != 'hidden'
},

be_hidden : function(actual) {
return !JSpec.does(actual, 'be_visible')
},

-Mark

Mark Nijhof

unread,
Jun 14, 2010, 8:35:17 AM6/14/10
to js...@googlegroups.com
I changed the be_hidden to also check for empty display selectors:

be_hidden : function(actual) {
return !JSpec.does(actual, 'be_visible') ||

jQuery(actual).css('display') == ''
},

And this works, please let me know if I am cheating too much here.

-Mark

On Mon, Jun 14, 2010 at 2:26 PM, Mark Nijhof

Mark Nijhof

unread,
Jun 14, 2010, 8:39:35 AM6/14/10
to js...@googlegroups.com
In IE there are still a lot of tests failing specifically around the be_hidden.

And for example:

will setup the cards placeholder to contain all needed elementsexpected
"<IMG class=BusineesCards alt=\"\"
src=\"http://cre8ivethought.com/images/Cre8iveBusinessCardsPresentation.png\">"
to match
/<img src=".*images\/Cre8iveBusinessCardsPresentation.png" alt=""
class="BusineesCards">/

order of attributes is different.

Anyway IE needs a manual test run either way :)

-Mark


On Mon, Jun 14, 2010 at 2:35 PM, Mark Nijhof

Reply all
Reply to author
Forward
0 new messages