/// <summary> /// 设置属性 /// </summary> protected override void SetAttributes() { Iframe control = this.ControlHost.Content as Iframe; this.HtmlWriter.AddAttribute("dojoType", "Controls/Iframe"); if (!IsPreview && !string.IsNullOrEmpty(this.ControlHost.Name)) { this.HtmlWriter.AddAttribute("id", this.ControlHost.Name); this.HtmlWriter.AddAttribute("name", this.ControlHost.Name); } StringBuilder sbProps = new StringBuilder(); StringBuilder returnContent = new StringBuilder(); string props = control.BuildControlProps(this.ScreenDefinition, this.IsPreview, this.PermissionData, returnContent); if (!string.IsNullOrEmpty(props)) { sbProps.AppendFormat("{0},", props); } if (sbProps.ToString().Length > 0) { this.HtmlWriter.AddAttribute("data-dojo-props", sbProps.ToString().Substring(0, sbProps.ToString().Length - 1), false); } base.SetAttributes(); }
public async Task PutUpdatesConfigurationInJsonIfThereIsPreviousConfiguration() { // Given await this.TestClient.DeleteAsync("admin/iframe"); Iframe configuration = new Iframe { Html = "<iframe></iframe>", }; string json = JsonConvert.SerializeObject(configuration); StringContent stringContent = new StringContent(json, UnicodeEncoding.UTF8, "application/json"); await this.TestClient.PostAsync("admin/iframe", stringContent); // When Iframe configuration2 = new Iframe { Html = "<iframe>new-iframe</iframe>", }; string json2 = JsonConvert.SerializeObject(configuration2); StringContent stringContent2 = new StringContent(json2, UnicodeEncoding.UTF8, "application/json"); await this.TestClient.PutAsync("admin/iframe", stringContent2); // Then HttpResponseMessage response = await this.TestClient.GetAsync("admin/iframe"); string jsonResponse = await response.Content.ReadAsStringAsync(); string expectedJson = "{\"WidgetType\":\"iframe\",\"ServiceName\":\"<iframe>new-iframe</iframe>\",\"RestApiUrls\":null,\"RestApiHeader\":null}"; Assert.Equal(expectedJson, jsonResponse); }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing && !_disposed) { if (_iframe != null) { _iframe = null; } _disposed = true; } }
protected override void OnElementChanged(ElementChangedEventArgs <WebView> e) { base.OnElementChanged(e); if (e.NewElement != null) { if (Control == null) { var embed = new Div { AddClassName = "embed-responsive" }; _iframe = new Iframe(); embed.AppendChild(_iframe); SetNativeControl(embed); } } Load(); }
public async Task IframeReturnsExpectedIframeResponse() { // Given await this.TestClient.DeleteAsync("admin/iframe"); Iframe configuration = new Iframe { Html = "<iframe></iframe>", }; string json = JsonConvert.SerializeObject(configuration); StringContent stringContent = new StringContent(json, UnicodeEncoding.UTF8, "application/json"); await this.TestClient.PostAsync("admin/iframe", stringContent); // When HttpResponseMessage response = await this.TestClient.GetAsync("view/iframe"); // Then string expectedJson = "[{\"html\":\"<iframe></iframe>\"}]"; string jsonResponse = await response.Content.ReadAsStringAsync(); Assert.Equal(expectedJson, jsonResponse); }
public async Task DeleteRemovesConfigurationInJson() { // Given Iframe configuration = new Iframe { Html = "<iframe></iframe>", }; string json = JsonConvert.SerializeObject(configuration); StringContent stringContent = new StringContent(json, UnicodeEncoding.UTF8, "application/json"); await this.TestClient.PostAsync("admin/iframe ", stringContent); // When await this.TestClient.DeleteAsync("admin/iframe"); // Then HttpResponseMessage response = await this.TestClient.GetAsync("admin/iframe"); string jsonResponse = await response.Content.ReadAsStringAsync(); string expectedJson = string.Empty; Assert.Equal(expectedJson, jsonResponse); }
public void SetUp() { _tag = new Iframe("http://src"); }