mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	fix unit tests
This commit is contained in:
		@@ -1203,7 +1203,7 @@
 | 
				
			|||||||
		isDOM || ($el = wgd.el);
 | 
							isDOM || ($el = wgd.el);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		var empty_upper_row = this.can_go_widget_up(wgd);
 | 
							var empty_upper_row = this.can_go_widget_up(wgd);
 | 
				
			||||||
		if (this.shift_widgets_up && empty_upper_row) {
 | 
							if (this.options.shift_widgets_up && empty_upper_row) {
 | 
				
			||||||
			wgd.row = empty_upper_row;
 | 
								wgd.row = empty_upper_row;
 | 
				
			||||||
			$el.attr('data-row', empty_upper_row);
 | 
								$el.attr('data-row', empty_upper_row);
 | 
				
			||||||
			this.$el.trigger('gridster:positionchanged', [wgd]);
 | 
								this.$el.trigger('gridster:positionchanged', [wgd]);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,7 @@ require.config({
 | 
				
			|||||||
    baseUrl: '../src/',
 | 
					    baseUrl: '../src/',
 | 
				
			||||||
    paths: {
 | 
					    paths: {
 | 
				
			||||||
        'QUnit': '../libs/qunit/qunit/qunit',
 | 
					        'QUnit': '../libs/qunit/qunit/qunit',
 | 
				
			||||||
        'jquery': '../libs/jquery/jquery',
 | 
					        'jquery': '../libs/jquery/dist/jquery',
 | 
				
			||||||
        'gridster': 'jquery.gridster'
 | 
					        'gridster': 'jquery.gridster'
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    map: {
 | 
					    map: {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@
 | 
				
			|||||||
    <meta charset="utf-8">
 | 
					    <meta charset="utf-8">
 | 
				
			||||||
    <title>gridster.js Test Suite</title>
 | 
					    <title>gridster.js Test Suite</title>
 | 
				
			||||||
    <!-- Load JQuery dependency. -->
 | 
					    <!-- Load JQuery dependency. -->
 | 
				
			||||||
    <script src="../libs/jquery/jquery.js"></script>
 | 
					    <script src="../libs/jquery/dist/jquery.js"></script>
 | 
				
			||||||
    <script>jQuery.noConflict()</script>
 | 
					    <script>jQuery.noConflict()</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <!-- load the gridster source files,  run the tests against the broken out javascipt in the source dir-->
 | 
					    <!-- load the gridster source files,  run the tests against the broken out javascipt in the source dir-->
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -233,6 +233,19 @@
 | 
				
			|||||||
		deepEqual(serialized, output);
 | 
							deepEqual(serialized, output);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						test('When Adding widgets rows static placement is supported', 2, function () {
 | 
				
			||||||
 | 
							var input = [{col: 6, row: 3, size_x: 1, size_y: 1}];
 | 
				
			||||||
 | 
							var grid = this.el.gridster().data('gridster');
 | 
				
			||||||
 | 
							grid.options.shift_widgets_up = false;
 | 
				
			||||||
 | 
							//remove any widgets from the html config
 | 
				
			||||||
 | 
							grid.remove_all_widgets();
 | 
				
			||||||
 | 
							//make sure we are empty
 | 
				
			||||||
 | 
							equal(grid.get_num_widgets(), 0, 'Clearing the widgets to prepare for tests');
 | 
				
			||||||
 | 
							grid.add_widget('<li />', input[0].size_x, input[0].size_y, input[0].col, input[0].row);
 | 
				
			||||||
 | 
							var serialized = grid.serialize();
 | 
				
			||||||
 | 
							deepEqual(serialized, input);
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	test('When Adding widgets cols are respected', 2, function () {
 | 
						test('When Adding widgets cols are respected', 2, function () {
 | 
				
			||||||
		var input = [{col: 6, row: 1, size_x: 1, size_y: 1}];
 | 
							var input = [{col: 6, row: 1, size_x: 1, size_y: 1}];
 | 
				
			||||||
		var grid = this.el.gridster().data('gridster');
 | 
							var grid = this.el.gridster().data('gridster');
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user