Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Additional tests for Element#makeClipping(), Element#undoClipping() #46

Open
wants to merge 1 commit into from

2 participants

@victor-homyakov

See ticket #1063:
1. Current implementation doesn't work properly for inline style="overflow:auto;"
2. Inline style isn't restored properly after undoClipping() - it is replaced with computed style
3. Computing style with Element.getStyle() isn't needed - performance optimization is possible

@savetheclocktower
Collaborator

I'll use these tests to help me fix #1063. Until then, I'll keep this open because I don't want to commit tests without the fix that will make them pass. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 6, 2012
  1. @victor-homyakov
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 5 deletions.
  1. +15 −5 test/unit/dom_test.js
View
20 test/unit/dom_test.js
@@ -676,14 +676,24 @@ new Test.Unit.Runner({
this.assertEqual(chained, chained.undoClipping());
this.assertEqual(chained, chained.undoClipping().makeClipping());
- ['hidden','visible','scroll'].each( function(overflowValue) {
- var element = $('element_with_'+overflowValue+'_overflow');
-
- this.assertEqual(overflowValue, element.getStyle('overflow'));
+ var items = [
+ {id: 'hidden', inline: 'hidden', computed: 'hidden'},
+ {id: 'visible', inline: 'visible', computed: 'visible'},
+ {id: 'scroll', inline: 'scroll', computed: 'scroll'},
+ {id: 'auto', inline: 'auto', computed: null},
+ {id: 'empty', inline: '', computed: 'visible'}
+ ];
+
+ items.each(function(item) {
+ var element = $('element_with_' + item.id + '_overflow');
+ this.assertEqual(item.inline, element.style.overflow, 'inline style');
+ this.assertEqual(item.computed, element.getStyle('overflow'), 'computed style');
element.makeClipping();
+ this.assertEqual('hidden', element.style.overflow);
this.assertEqual('hidden', element.getStyle('overflow'));
element.undoClipping();
- this.assertEqual(overflowValue, element.getStyle('overflow'));
+ this.assertEqual(item.inline, element.style.overflow, 'restored inline style');
+ this.assertEqual(item.computed, element.getStyle('overflow'), 'restored computed style');
}, this);
},
Something went wrong with that request. Please try again.