Skip to content

Commit

Permalink
Drop inCard, broke null section positions
Browse files Browse the repository at this point in the history
  • Loading branch information
mixonic committed Nov 10, 2015
1 parent a1d1df0 commit 2300311
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
2 changes: 0 additions & 2 deletions src/js/utils/cursor/position.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,12 @@ const Position = class Position {
constructor(section, offset=0) {
this.section = section;
this.offset = offset;
this._inCard = section.isCardSection;
}

static emptyPosition() {
return {
section: null,
offset: 0,
_inCard: false,
marker: null,
offsetInTextNode: 0,
_isEmpty: true,
Expand Down
13 changes: 1 addition & 12 deletions tests/acceptance/cursor-position-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ test('cursor focused on card wrapper with 0 offset', (assert) => {
assert.equal(offsets.tail.offset, 0,
'Cursor tail is positioned at offset 0');
});

// see https://github.com/bustlelabs/mobiledoc-kit/issues/215
test('selecting the entire editor element reports a selection range of the entire post', (assert) => {
let mobiledoc = Helpers.mobiledoc.build(({post, markupSection, marker}) => {
Expand All @@ -221,14 +221,3 @@ test('selecting the entire editor element reports a selection range of the entir
'tail section correct');
assert.equal(offsets.tail.offset, 4, 'tail offset equals section length');
});

//inside card wrapper div and before starting zwnj reports its position correctly');

/*
// These could maybe be done better with arrow keys to get in the cases we want
// to reproduce. Jumping straight to the DOM nodes in not very acceptancy and may
// obscure real browser behavior.
test('cursor inside card wrapper div and after starting zwnj reports its position correctly');
test('cursor inside card wrapper div and before ending zwnj reports its position correctly');
test('cursor inside card wrapper div and after ending zwnj reports its position correctly');
*/
15 changes: 15 additions & 0 deletions tests/unit/editor/editor-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,18 @@ test('useful error message when given invalid mobiledoc', (assert) => {
new Editor({mobiledoc: verybadMobiledoc}); // jshint ignore:line
}, /unable to parse.*mobiledoc/i);
});

test('activeSections of a rendered blank mobiledoc is an empty array', (assert) => {
let mobiledoc = {
version: MOBILEDOC_VERSION,
sections: [
[],
[]
]
};
editor = new Editor({mobiledoc});
editor.render(editorElement);

assert.equal(0, editor.activeSections.length,
'empty activeSections');
});

0 comments on commit 2300311

Please sign in to comment.