override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); _ddm.ID = "ddm"; _ddm.Height = new Unit("1%"); _ddm.Width = new Unit("1%"); _ddm.TitleText = "Options Menu"; MultiView.TopControls.Add(_ddm); WebButton saveButton = new WebButton(); saveButton.ID = "SaveButton"; saveButton.Text = "Save"; saveButton.Style["margin-right"] = "10pt"; saveButton.Click += new EventHandler(SaveButton_Click); MultiView.TopControls.Add(saveButton); WebButton cancelButton = new WebButton(); cancelButton.ID = "CancelButton"; cancelButton.Text = "Cancel"; cancelButton.Style["margin-right"] = "10pt"; cancelButton.Click += new EventHandler(CancelButton_Click); cancelButton.UseSubmitBehavior = false; MultiView.TopControls.Add(cancelButton); _wxeControlsPlaceHolder = new PlaceHolder(); MultiView.BottomControls.Add(_wxeControlsPlaceHolder); base.OnInit(e); }
public override void CreateCloseButtonFor(Dialog dialogToClose) { _closeButton = new WebButton(); // Nackdel: upprepande kod _closeButton.Render(); _dialogToClose = dialogToClose; }
public void GetVirtualPath_AppRelativeTemplateSourceDirectory_Null() { var controlStub = new WebButton(); controlStub.ID = "ControlID"; controlStub.AppRelativeTemplateSourceDirectory = null; Assert.That(() => VirtualPathUtility.GetVirtualPath(controlStub, "../relative/file.txt"), Throws.InvalidOperationException); }
private WebButton CreateButtonWithoutClickEventHandler() { WebButton button = new WebButton(); button.MissingPermissionBehavior = MissingPermissionBehavior.Disabled; button.SecurableObject = _mockSecurableObject; return(button); }
private TableRow[] ExpectWebButtonAttributes(WebButton button) { List <TableRow> rows = new List <TableRow>(); rows.Add(ExpectElementTag(button, "BUTTON")); rows.Add(ExpectAttribute(button, "type", button.UseSubmitBehavior ? "submit" : "button")); return(rows.ToArray()); }
private Control CreateButtonControlWithSubmitBehavior(string prefix) { WebButton button = new WebButton(); button.ID = CreateID(prefix, "ButtonSubmit"); button.Text = "Submit"; button.UseSubmitBehavior = true; button.Click += OnClick; return(button); }
public override void Render() { OkButton = new WebButton(); var renderResult = OkButton.Render(); _events.Add($"Ok button rendered as: {renderResult}"); OkButton.OnClick = CloseDialog; }
public void GetVirtualPath_AppRelativeTemplateSourceDirectory_Empty() { var controlStub = new WebButton(); controlStub.ID = "ControlID"; controlStub.AppRelativeTemplateSourceDirectory = ""; Assert.That( () => VirtualPathUtility.GetVirtualPath(controlStub, "../relative/file.txt"), Throws.InvalidOperationException .And.Message.StartsWith("The 'AppRelativeTemplateSourceDirectory' property of the WebButton 'ControlID' is not set.")); }
public void Base_Select_Item_Menu_From_Left_Panel(string itemsPath) { var listItems = itemsPath.Split('.'); for (var i = 0; i < listItems.Length; i++) { var item = new WebButton(findElement(LeftMenuRepo.DY_MENULEFT_ITEM, (i + 1).ToString(), listItems[i])); item.Click(); staticWait(1); } }
public void EvaluateFalse_FromFalse() { WebButton button = CreateButtonWithClickEventHandler(); button.Enabled = false; _mocks.ReplayAll(); bool enabled = button.Enabled; _mocks.VerifyAll(); Assert.That(enabled, Is.False); }
public void EvaluateTrue_FromTrueAndWithoutClickEventHandler() { WebButton button = CreateButtonWithoutClickEventHandler(); button.Enabled = true; _mocks.ReplayAll(); bool enabled = button.Enabled; _mocks.VerifyAll(); Assert.That(enabled, Is.True); }
override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); WebButton saveButton = new WebButton(); saveButton.ID = "SaveButton"; saveButton.Text = "Save"; saveButton.Style["margin-right"] = "10pt"; saveButton.Click += new EventHandler(SaveButton_Click); MultiView.TopControls.Add(saveButton); WebButton cancelButton = new WebButton(); cancelButton.ID = "CancelButton"; cancelButton.Text = "Cancel"; cancelButton.Style["margin-right"] = "10pt"; cancelButton.Click += new EventHandler(CancelButton_Click); MultiView.TopControls.Add(cancelButton); WebButton postBackButton = new WebButton(); postBackButton.ID = "PostBackButton"; postBackButton.Text = "Postback"; postBackButton.Style["margin-right"] = "10pt"; MultiView.BottomControls.Add(postBackButton); WebButton validateButton = new WebButton(); validateButton.ID = "ValidateButton"; validateButton.Text = "&Validate"; validateButton.Style["margin-right"] = "10pt"; validateButton.Click += new EventHandler(ValidateButton_Click); MultiView.BottomControls.Add(validateButton); _wxeControlsPlaceHolder = new PlaceHolder(); MultiView.BottomControls.Add(_wxeControlsPlaceHolder); base.OnInit(e); this.EnableAbort = true; this.ShowAbortConfirmation = ShowAbortConfirmation.OnlyIfDirty; LoadUserControls(); new BocList().RegisterHtmlHeadContents(HtmlHeadAppender.Current); new DropDownMenu().RegisterHtmlHeadContents(HtmlHeadAppender.Current); new ListMenu().RegisterHtmlHeadContents(HtmlHeadAppender.Current); }
public void EvaluateFalse_FromFalseAndWithMissingPermissionBehaviorSetToInvisible() { WebButton button = CreateButtonWithClickEventHandler(); button.MissingPermissionBehavior = MissingPermissionBehavior.Invisible; button.Enabled = false; _mocks.ReplayAll(); bool enabled = button.Enabled; _mocks.VerifyAll(); Assert.That(enabled, Is.False); }
public void EvaluateFalse_FromTrueAndAccessDenied() { Expect.Call(_mockWebSecurityAdapter.HasAccess(_mockSecurableObject, new EventHandler(TestHandler))).Return(false); WebButton button = CreateButtonWithClickEventHandler(); button.Enabled = true; _mocks.ReplayAll(); bool enabled = button.Enabled; _mocks.VerifyAll(); Assert.That(enabled, Is.False); }
public void EvaluateTrue_FromTrueAndWithoutWebSeucrityProvider() { var serviceLocator = DefaultServiceLocator.Create(); serviceLocator.RegisterMultiple <IWebSecurityAdapter>(); serviceLocator.RegisterMultiple <IWxeSecurityAdapter>(); using (new ServiceLocatorScope(serviceLocator)) { WebButton button = CreateButtonWithClickEventHandler(); button.Enabled = true; _mocks.ReplayAll(); bool enabled = button.Enabled; _mocks.VerifyAll(); Assert.That(enabled, Is.True); } }
internal static WebControl GetWebControlFromIContol(IControl aControl, Browser aBrowser, Locator aLocator, ControlType aConrolType) { WebControl aWebControl = null; if (aConrolType == ControlType.Button) { WebButton aWebButton = new WebButton(aBrowser, aLocator); aWebButton.Control = aControl; aWebControl = aWebButton; } if (aConrolType == ControlType.EditBox) { WebEditBox aWebEditBox = new WebEditBox(aBrowser, aLocator); aWebEditBox.Control = aControl; aWebControl = aWebEditBox; } if (aConrolType == ControlType.Custom) { aWebControl = new WebControl(aBrowser, aLocator); aWebControl.Control = aControl; //aWebControl = aWebEditBox; } if (aConrolType == ControlType.Calender) { WebCalender aWebCalender = new WebCalender(aBrowser, aLocator); aWebCalender.Control = aControl; aWebControl = aWebCalender; } if (aConrolType == ControlType.ComboBox) { WebComboBox aWebComboBox = new WebComboBox(aBrowser, aLocator); aWebComboBox.Control = aControl; aWebControl = aWebComboBox; } if (aConrolType == ControlType.CheckBox) { WebCheckBox aWebCheckBox = new WebCheckBox(aBrowser, aLocator); aWebCheckBox.Control = aControl; aWebControl = aWebCheckBox; } if (aConrolType == ControlType.Dialog) { WebDialog aWebDialog = new WebDialog(aBrowser, aLocator); aWebDialog.Control = aControl; aWebControl = aWebDialog; } if (aConrolType == ControlType.Frame) { WebFrame aWebFrame = new WebFrame(aBrowser, aLocator); aWebFrame.Control = aControl; aWebControl = aWebFrame; } if (aConrolType == ControlType.Image) { WebImage aWebImage = new WebImage(aBrowser, aLocator); aWebImage.Control = aControl; aWebControl = aWebImage; } if (aConrolType == ControlType.Label) { WebLabel aWebLabel = new WebLabel(aBrowser, aLocator); aWebLabel.Control = aControl; aWebControl = aWebLabel; } if (aConrolType == ControlType.Link) { WebLink aWebLink = new WebLink(aBrowser, aLocator); aWebLink.Control = aControl; aWebControl = aWebLink; } if (aConrolType == ControlType.ListBox) { WebListBox aWebListBox = new WebListBox(aBrowser, aLocator); aWebListBox.Control = aControl; aWebControl = aWebListBox; } if (aConrolType == ControlType.Page) { WebPage aWebPage = new WebPage(aBrowser, aLocator); aWebPage.Control = aControl; aWebControl = aWebPage; } if (aConrolType == ControlType.RadioButton) { WebRadioButton aWebRadioButton = new WebRadioButton(aBrowser, aLocator); aWebRadioButton.Control = aControl; aWebControl = aWebRadioButton; } if (aConrolType == ControlType.SpanArea) { WebSpanArea aWebSpanArea = new WebSpanArea(aBrowser, aLocator); aWebSpanArea.Control = aControl; aWebControl = aWebSpanArea; } if (aConrolType == ControlType.WebTable) { WebTable aWebTable = new WebTable(aBrowser, aLocator); aWebTable.Control = aControl; aWebControl = aWebTable; } if (aConrolType == ControlType.WebRow) { WebRow aWebRow = new WebRow(aBrowser, aLocator); aWebRow.Control = aControl; aWebControl = aWebRow; } if (aConrolType == ControlType.WebCell) { WebCell aWebCell = new WebCell(aBrowser, aLocator); aWebCell.Control = aControl; aWebControl = aWebCell; } return aWebControl; }