| 
									
										
										
										
											2015-05-22 16:04:16 -04:00
										 |  |  | describe("Zotero.Groups", function () { | 
					
						
							|  |  |  | 	describe("#get()", function () { | 
					
						
							|  |  |  | 		it("should retrieve a newly created group", function* () { | 
					
						
							|  |  |  | 			try { | 
					
						
							| 
									
										
										
										
											2015-06-01 20:00:25 -04:00
										 |  |  | 				var group = yield createGroup(); | 
					
						
							|  |  |  | 				assert.equal(Zotero.Groups.get(group.id), group) | 
					
						
							| 
									
										
										
										
											2015-05-22 16:04:16 -04:00
										 |  |  | 			} | 
					
						
							|  |  |  | 			finally { | 
					
						
							|  |  |  | 				if (group) { | 
					
						
							| 
									
										
										
										
											2015-06-07 15:40:04 -04:00
										 |  |  | 					yield Zotero.DB.executeTransaction(function* () { | 
					
						
							|  |  |  | 						return group.erase(); | 
					
						
							|  |  |  | 					}) | 
					
						
							| 
									
										
										
										
											2015-05-22 16:04:16 -04:00
										 |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		}) | 
					
						
							|  |  |  | 	}) | 
					
						
							| 
									
										
										
										
											2016-03-25 16:48:33 -04:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	describe("#save()", function () { | 
					
						
							|  |  |  | 		it("should trigger notifier event for inherited properties", function* () { | 
					
						
							|  |  |  | 			var group = yield createGroup({ | 
					
						
							|  |  |  | 				editable: false | 
					
						
							|  |  |  | 			}); | 
					
						
							|  |  |  | 			group.editable = true; | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 			var promise = waitForNotifierEvent('modify', 'group'); | 
					
						
							|  |  |  | 			yield group.saveTx(); | 
					
						
							|  |  |  | 			var data = yield promise; | 
					
						
							|  |  |  | 			assert.lengthOf(data.ids, 1); | 
					
						
							|  |  |  | 			assert.sameMembers(data.ids, [group.id]); | 
					
						
							|  |  |  | 		}); | 
					
						
							|  |  |  | 	}); | 
					
						
							| 
									
										
										
										
											2015-05-22 16:04:16 -04:00
										 |  |  | }) |