Files
Syed Ali Abbas Zaidi f1fb38ed83 fix: multi lines and spaces issues (#31885)
* fix: multi lines and spaces issues

* fix: eslint operator-linebreak issue

* fix: eslint quotes issue

* fix: remaining quotes issues

* fix: eslint object curly newline issue

* fix: eslint object curly spacing issue

* fix: eslint brace-style issues

* fix: react jsx indent and props issues

* fix: eslint trailing spaces issues

* fix: eslint linbreak style issue

* fix: eslint space unary operator issue

* fix: eslint line around directives issue

* fix: void and typeof space unary ops issue
2023-05-03 12:22:46 +05:00

54 lines
2.0 KiB
JavaScript

define([
'js/spec/edxnotes/helpers', 'js/edxnotes/collections/notes'
], function(Helpers, NotesCollection) {
'use strict';
describe('EdxNotes NoteModel', function() {
beforeEach(function() {
this.collection = new NotesCollection(
{
count: 2,
current_page: 1,
num_pages: 1,
start: 0,
next: null,
previous: null,
results: [
{quote: Helpers.LONG_TEXT, text: 'text\n with\r\nline\n\rbreaks \r'},
{quote: Helpers.SHORT_TEXT, text: 'text\n with\r\nline\n\rbreaks \r'}
]
},
{
perPage: 10, parse: true
}
);
});
it('has correct values on initialization', function() {
expect(this.collection.at(0).get('is_expanded')).toBeFalsy();
expect(this.collection.at(0).get('show_link')).toBeTruthy();
expect(this.collection.at(1).get('is_expanded')).toBeFalsy();
expect(this.collection.at(1).get('show_link')).toBeFalsy();
});
it('can return appropriate `quote`', function() {
var model = this.collection.at(0);
// is_expanded = false, show_link = true
expect(model.getQuote()).toBe(Helpers.PRUNED_TEXT);
model.set('is_expanded', true);
// is_expanded = true, show_link = true
expect(model.getQuote()).toBe(Helpers.LONG_TEXT);
model.set('show_link', false);
model.set('is_expanded', false);
// is_expanded = false, show_link = false
expect(model.getQuote()).toBe(Helpers.LONG_TEXT);
});
it('can return appropriate `text`', function() {
var model = this.collection.at(0);
expect(model.get('text')).toBe('text\n with\r\nline\n\rbreaks \r');
});
});
});