<commit_before>define([
    'jasmine-jquery',
    'streamhub-timeline',
    'streamhub-sdk',
    '../MockStream'],
function (jasmine, TimelineView, Hub, MockStream) {
describe('A TimelineView', function () {
	// construction behavior
    describe('can be constructed', function() {
    	it ("with no options", function () {
	        var view = new TimelineView();
        	expect(view).toBeDefined();
    	});
    	it ("with empty options", function () {
        	var view = new TimelineView({});
        	expect(view).toBeDefined();
    	});
	    it ("with an el", function () {
	        setFixtures('<div id="hub-TimelineView"></div>');  
	        var view = new TimelineView({
	            el: $('#hub-TimelineView').get(0)
	        });
	        expect(view).toBeDefined();
	    });
	});
	
	// post construction behavior    
    describe ("after correct construction and binding", function () {
	    var view, streams;
	    
	    beforeEach(function() {
	        setFixtures('<div id="hub-TimelineView"></div>');
	        view = new TimelineView({
	            el: $('#hub-TimelineView').get(0)
	        });
	        console.log('here 1');
	        streams = new Hub.StreamManager({ main: new MockStream() });
	        console.log('here 2');
            streams.bind(view);
		});
        it ("should contain 50 mock items after streams.start()", function () {
            streams.start();
            expect(view.$el.find('.events ul>li').length).toBe(50);
        });
        it ("should call function pointer on click", function () {
        	var counter = 0;
        	view.onClick = function() {
        		counter++;
        	};
            streams.start();
        	view.$el.find('.events ul>li').get(20).click();
            expect(counter).toBe(1);
        });
        it ("should filter on start and end dates", function () {
        	var content = [streams.get('main')._createMockContent(),
	        	streams.get('main')._createMockContent(),
	        	streams.get('main')._createMockContent(),
	        	streams.get('main')._createMockContent(),
	        	streams.get('main')._createMockContent()];
	        
        	view.startDate = content[1].createdAt * 1000;
        	view.endDate = content[3].createdAt * 1000;
        	for (i in content) {
        		view.emit('add', content[i]);
        	}
            expect(view.$el.find('.events ul>li').length).toBe(3);
        });
        it ("should pass extra meta content", function () {
        	var content = streams.get('main')._createMockContent();
        	content.body = '<p>test</p><em>{"eventType":"testType", "eventImportant":"true"}</em>';

        	view.metaElement = 'em';

        	view.emit('add', content);
            expect(view.$el.find('.events ul>li').length).toBe(1);
            expect(view.$el.find('.events ul>li').attr('data-hub-event-type')).toBe('testType');
            expect(view.$el.find('.events ul>li').attr('data-hub-event-important')).toBe('true');
        });
    });
}); 
});<commit_msg>Update invocation of view's add method in tests<commit_after>define([
    'jasmine-jquery',
    'streamhub-timeline',
    'streamhub-sdk',
    '../MockStream'],
function (jasmine, TimelineView, Hub, MockStream) {
describe('A TimelineView', function () {
	// construction behavior
    describe('can be constructed', function() {
    	it ("with no options", function () {
	        var view = new TimelineView();
        	expect(view).toBeDefined();
    	});
    	it ("with empty options", function () {
        	var view = new TimelineView({});
        	expect(view).toBeDefined();
    	});
	    it ("with an el", function () {
	        setFixtures('<div id="hub-TimelineView"></div>');  
	        var view = new TimelineView({
	            el: $('#hub-TimelineView').get(0)
	        });
	        expect(view).toBeDefined();
	    });
	});
	
	// post construction behavior    
    describe ("after correct construction and binding", function () {
	    var view, streams;
	    
	    beforeEach(function() {
	        setFixtures('<div id="hub-TimelineView"></div>');
	        view = new TimelineView({
	            el: $('#hub-TimelineView').get(0)
	        });
	        console.log('here 1');
	        streams = new Hub.StreamManager({ main: new MockStream() });
	        console.log('here 2');
            streams.bind(view);
		});
        it ("should contain 50 mock items after streams.start()", function () {
            streams.start();
            expect(view.$el.find('.events ul>li').length).toBe(50);
        });
        it ("should call function pointer on click", function () {
        	var counter = 0;
        	view.onClick = function() {
        		counter++;
        	};
            streams.start();
        	view.$el.find('.events ul>li').get(20).click();
            expect(counter).toBe(1);
        });
        it ("should filter on start and end dates", function () {
        	var content = [streams.get('main')._createMockContent(),
	        	streams.get('main')._createMockContent(),
	        	streams.get('main')._createMockContent(),
	        	streams.get('main')._createMockContent(),
	        	streams.get('main')._createMockContent()];

            view.startDate = content[1].createdAt * 1000;
            view.endDate = content[3].createdAt * 1000;
        	for (i in content) {
                view.add(content[i]);
        	}
            expect(view.$el.find('.events ul>li').length).toBe(3);
        });
        it ("should pass extra meta content", function () {
        	var content = streams.get('main')._createMockContent();
        	content.body = '<p>test</p><em>{"eventType":"testType", "eventImportant":"true"}</em>';

        	view.metaElement = 'em';

            view.add(content);
            expect(view.$el.find('.events ul>li').length).toBe(1);
            expect(view.$el.find('.events ul>li').attr('data-hub-event-type')).toBe('testType');
            expect(view.$el.find('.events ul>li').attr('data-hub-event-important')).toBe('true');
        });
    });
}); 
});
{'fraction_non_alphanumeric': 0.17600934267600934, 'fraction_numerical': 0.008008008008008008, 'mean_word_length': 2.261697497279652, 'pattern_counts': {'":': 4, '<': 19, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3714193', 'n_tokens_mistral': 1795, 'n_tokens_neox': 1717, 'n_words': 341}