Skip to content

Commit

Permalink
Tests for #12690 proving the problem with bender.tools.
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Nov 20, 2014
1 parent c26ba23 commit 505e786
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
12 changes: 10 additions & 2 deletions bender.js
Expand Up @@ -85,7 +85,11 @@ var config = {
'tests/plugins/magicline/widgets#test commands[previous], first block in nested': 'env.gecko',
'tests/plugins/magicline/widgets#test commands[next], block after block in nested': 'env.gecko',
'tests/plugins/magicline/widgets#test commands[previous], block before block in nested': 'env.gecko',
'tests/plugins/magicline/widgets#test commands[next], last block in nested': 'env.gecko'
'tests/plugins/magicline/widgets#test commands[next], last block in nested': 'env.gecko',

// Safari (#12690)
'tests/plugins/font/font#test apply font size over another font size (collapsed selection in empty span)': 'env.safari',
'tests/plugins/font/font#test apply font size over another font size (deeply nested collapsed selection)': 'env.safari'
}
},

Expand Down Expand Up @@ -117,7 +121,11 @@ var config = {
paths: [
'utils/**',
'!**/_*/**'
]
],
regressions: {
// Safari (#12690)
'tests/utils/selection/setgetwithhtml#test setSelection - in empty inline element': 'env.safari'
}
}
}
};
Expand Down
17 changes: 17 additions & 0 deletions tests/core/selection/selection.js
Expand Up @@ -229,6 +229,23 @@ bender.test( {
'the selection was located after the strong element' );
},

// #12690
'test selectRanges - inside empty inline element': function() {
var editor = this.editor,
range = editor.createRange();

editor.editable().setHtml( '<p>x<span style="font-size:48px"><strong id="target"></strong></span>x</p>' );

var strong = editor.document.getById( 'target' );
range.setStart( strong, 0 );
range.collapse( true );

editor.getSelection().selectRanges( [ range ] );

var sel = editor.getSelection();
assert.isTrue( strong.equals( sel.getStartElement() ) );
},

'test getSelectedElement': function() {
testSelectedElement( '[<img />]', 'img' );
testSelectedElement( '[<hr />]', 'hr' );
Expand Down
10 changes: 10 additions & 0 deletions tests/utils/selection/setgetwithhtml.js
Expand Up @@ -100,6 +100,16 @@
} );
},

// #12690
'test setSelection - in empty inline element': function() {
var editor = this.editor;

bender.tools.selection.setWithHtml( editor, '<p>x<span style="font-size:48px"><strong>[]</strong></span>x</p>' );

var sel = editor.getSelection();
assert.areSame( 'strong', sel.getStartElement().getName() );
},

'test getSelection - element': function() {
var editor = this.editor,
htmlWithRange = '<p>[x]</p>';
Expand Down

0 comments on commit 505e786

Please sign in to comment.