Skip to content

Conversation

@youngminpark2559
Copy link

Looks like something is somewhat working. But not a good implementation. Hope you to refactor and show right implementations.

@youngminpark2559
Copy link
Author

Update 1st code for Accordion Bootstrap. I don't figure out the reason why Accordion's links wouldn't be clicked in a row in test. Only 1st link(AccordionItems[0].ATag.Click()) is clicked and test is terminated.

@YevgeniyShunevych
Copy link
Member

Thank you. I will review tomorrow.

@youngminpark2559
Copy link
Author

youngminpark2559 commented Nov 1, 2017

I wonder these parts.
1.
In ListGroupPage.cs,
at this code,
[FindByXPath("h4[@Class='list-group-item-heading']", Index =0)]
public Control<_> CustomContentByXPath { get; set; }

I tried to find the following element from ListGroups.html, line 97
<h4 class="list-group-item-heading">List group item heading</h4>

from this group

<h4>Custom content</h4>
		<div class="panel panel-default">
			<div class="list-group">
				<a href="#" class="list-group-item active">
					<h4 class="list-group-item-heading">List group item heading</h4>//<-Here
					<p class="list-group-item-text">List group item text</p>
				</a>

by these finding codes in ListGroupPage.cs,
[FindByXPath("a[@Class='list-group-item']//following::h4")]
[FindByXPath("a[@Class='list-group-item']//descendant::h4")]
[FindByXPath("a[@Class='list-group-item active']//following::h4")]
[FindByXPath("a[@Class='list-group-item active']//descendant::h4")]

but they didn't work, but I don't figure out the reason.

I assume that the code that I wrote may need the implementation which deals with dynamical changes of active or disable. Is it right?
It seems like I find class attribute which is additionally marked with "active" by hard coded statement like,
ListGroupPage.cs, line 22.
[FindByClass("list-group-item active")]
public BSListGroupItem<_> ListGroupItemWithActive { get; private set; }

@YevgeniyShunevych
Copy link
Member

  1. You can try such XPath:
    [FindByXPath("h4[text() = 'Custom content']/following::a[@class='list-group-item active']/following::h4")]
    You need to find the correct 'Custom content' section of page.
  2. It is needed to add DataProvider property to BSListGroupItem<TOwner> which will detect 'active' class and return true if the control has this class:
    public DataProvider<bool, TOwner> IsActive => GetOrCreateDataProvider(
        nameof(IsActive).ToString(TermCase.MidSentence),
        () => Attributes.Class.Value.Contains(BSClass.Active));
    To change the default behavior of IsEnabled property of control you can override GetIsEnabled method in BSListGroupItem<TOwner>:
    protected override bool GetIsEnabled()
    {
        return !Scope.HasClass(BSClass.Disabled);
    }
    And then in the test you can verify state of list group items:
    Control.Should.BeDisabled().
    AnotherControl.Should.BeEnabled().
    AnotherControl.IsActive.Should.BeTrue();

@youngminpark2559
Copy link
Author

Thank you for the guide. I could learn valuable things by your comment.

It was not easy to figure out how to apply XPath grammar fluently to search element.

So, I tried to use XPath Helper chrome plugin. I tried to use it to check if my XPath statements would work well in real time, and I figured out that plugin could generate a specific XPath automatically when I'd mouse over a specific element on the web page with holding shift key.
The thing looking like flaw is that it only uses basic syntax of XPath, not using these grammar like following::a, descendant::h4

@youngminpark2559
Copy link
Author

I added and edited some functionalities.
Please check if they're right implementations.
In case of the BSAccordion`1.cs, I don't know why
[ControlDefinition("a[@data-toggle='collapse' AND @data-parent='#accordion']", ComponentTypeName = "collapse with accordion")] this one which contains 'AND' doesn't work.

@YevgeniyShunevych
Copy link
Member

Hi,

For generic components you should not use such XPath parts: "@data-parent='#accordion'". Id is specific parameter and can definitely vary. Accordion is quite complex control, leave it please, I will try to handle Collapse and Accordion controls myself.

Also I want to ask you to remove from this pull request all files related to Collapse, Accordion and Carousel. Let's keep one pull request for one feature (single component or pair of associated components). Let's have this PR for BSListGroup and BSListGroupItem. After you clean it, please let me know and wait for me to merge this PR. After that you can sync your fork with master and work on next PR, BSCarousel if you wish.

@YevgeniyShunevych YevgeniyShunevych changed the title Add test code for Accordion Bootstrap BSListGroup<TItem, TOwner> and BSListGroupItem<TOwner> components Nov 6, 2017
@YevgeniyShunevych YevgeniyShunevych added this to the 0.6.0 milestone Nov 6, 2017
@youngminpark2559
Copy link
Author

Cleaned files related to Collapse, Accordion and Carousel. And made files related to BSListGroup and BSListGroupItem stay. Okay, after merge, I'll try to sync this with master.

@YevgeniyShunevych
Copy link
Member

Thanks. I made some corrections to your pull request 96e064c. But I went wrong way and did it via branch pr/3. Then merged the branch to master with squash commit 55348ef. So the changes of your PR are merged with mine corrections and are on master. I am just closing this PR. Thanks again for your contribution.

@youngminpark2559
Copy link
Author

Thanks for accepting my implementations. I'll review the corrections. No problem. I'll try to do more.

@youngminpark2559
Copy link
Author

I tried to sync a fork to master, and it looks like all changes of master are reflected to my local repository.
However, I wonder this. Should I remove these signs manually one by one from some source file?
<<<<<<< HEAD, =======, >>>>>>> upstream/master.
Is it normal to see these signs in source code in doing this "sync a for"?
Or did I do something wrong?

I followed these steps to sync my forked local repository to master.

  1. git remote add upstream https://github.com/atata-framework/atata-bootstrap.git
  2. git fetch upstream
  3. git merge upstream/master
  4. In Visual Studio, to resolve all conflicts, I staged all changes by clicking "+" button.
  5. I pushed them to my repository in Github.

I checked them again by repeating all the above steps, and I didn't get any errors. Like this :

$ git checkout master
Already on 'master'
Your branch is up-to-date with 'origin/master'.

$ git merge upstream/master
Already up-to-date.

@YevgeniyShunevych
Copy link
Member

Please try the following commands:

git fetch upstream
git checkout master
git reset --hard upstream/master
git push origin master --force

These commands should completely reset your fork.

@youngminpark2559
Copy link
Author

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants