| 95 | 
  95 | 
  
          assert_select 'table.issues.sort-by-due-date' 
   | 
  | 96 | 
  96 | 
  
        end 
   | 
  | 97 | 
  97 | 
  
      end 
   | 
  | 98 | 
   | 
  
      
   | 
   | 
  98 | 
  
    
   | 
  | 99 | 
  99 | 
  
      def test_page_with_issuequery_block_and_no_settings 
   | 
  | 100 | 
  100 | 
  
        user = User.find(2) 
   | 
  | 101 | 
  101 | 
  
        user.pref.my_page_layout = {'top' => ['issuequery']}
   | 
  | ... | ... |  | 
  | 198 | 
  198 | 
  
        end 
   | 
  | 199 | 
  199 | 
  
      end 
   | 
  | 200 | 
  200 | 
  
    
   | 
   | 
  201 | 
  
      def test_page_with_assigned_issues_block_and_should_not_display_closed_projects 
   | 
   | 
  202 | 
  
        user = User.find(2) 
   | 
   | 
  203 | 
  
        User.current = user 
   | 
   | 
  204 | 
  
        preferences = user.pref 
   | 
   | 
  205 | 
  
        preferences.my_page_settings = {'issuesassignedtome' => {:sort => "#{Issue.table_name}.id asc"}}
   | 
   | 
  206 | 
  
        preferences.save! 
   | 
   | 
  207 | 
  
    
   | 
   | 
  208 | 
  
        Issue.update_all(:assigned_to_id => user.id) 
   | 
   | 
  209 | 
  
    
   | 
   | 
  210 | 
  
        query = IssueQuery.new(:name => 'label_assigned_to_me_issues', :user => User.current) 
   | 
   | 
  211 | 
  
        query.add_filter 'assigned_to_id', '=', ['me'] 
   | 
   | 
  212 | 
  
        query.add_available_filter('project.status', :type => :integer)
   | 
   | 
  213 | 
  
        query.add_filter 'project.status', '=', ["#{Project::STATUS_ACTIVE}"]
   | 
   | 
  214 | 
  
        query.sort_criteria = [['id', 'asc']] 
   | 
   | 
  215 | 
  
        totalcount_issues = query.issue_count 
   | 
   | 
  216 | 
  
    
   | 
   | 
  217 | 
  
        project = Project.find_by_identifier('subproject1')
   | 
   | 
  218 | 
  
        project.close 
   | 
   | 
  219 | 
  
        project.reload 
   | 
   | 
  220 | 
  
        totalcount_issues_without_closed_project = query.issue_count 
   | 
   | 
  221 | 
  
        display_issues = query.issues(:limit => 10) 
   | 
   | 
  222 | 
  
    
   | 
   | 
  223 | 
  
        assert_not_equal totalcount_issues_without_closed_project, totalcount_issues 
   | 
   | 
  224 | 
  
    
   | 
   | 
  225 | 
  
        get :page 
   | 
   | 
  226 | 
  
        assert_response :success 
   | 
   | 
  227 | 
  
    
   | 
   | 
  228 | 
  
        assert_select '#block-issuesassignedtome' do 
   | 
   | 
  229 | 
  
          assert_select 'h3', :text => /[\s\S]*\(#{totalcount_issues_without_closed_project}\)\z/m
   | 
   | 
  230 | 
  
          assert_select 'table.issues' do 
   | 
   | 
  231 | 
  
            assert_select 'tr.issue', display_issues.count 
   | 
   | 
  232 | 
  
            display_issues.each_with_index do |issue, idx| 
   | 
   | 
  233 | 
  
              assert_select "tr.issue:nth-of-type(#{idx + 1})#issue-#{issue.id}"
   | 
   | 
  234 | 
  
            end 
   | 
   | 
  235 | 
  
          end 
   | 
   | 
  236 | 
  
        end 
   | 
   | 
  237 | 
  
      end 
   | 
   | 
  238 | 
  
    
   | 
   | 
  239 | 
  
      def test_page_with_reported_issues_block_and_should_not_display_closed_projects 
   | 
   | 
  240 | 
  
        user = User.find(2) 
   | 
   | 
  241 | 
  
        User.current = user 
   | 
   | 
  242 | 
  
        preferences = user.pref 
   | 
   | 
  243 | 
  
        preferences.my_page_settings = {'issuesreportedbyme' => {:sort => "#{Issue.table_name}.id asc"}}
   | 
   | 
  244 | 
  
        preferences.save! 
   | 
   | 
  245 | 
  
    
   | 
   | 
  246 | 
  
        query = IssueQuery.new(:name => 'label_reported_issues', :user => User.current) 
   | 
   | 
  247 | 
  
        query.add_filter 'author_id', '=', ['me'] 
   | 
   | 
  248 | 
  
        query.add_available_filter('project.status', :type => :integer)
   | 
   | 
  249 | 
  
        query.add_filter 'project.status', '=', ["#{Project::STATUS_ACTIVE}"]
   | 
   | 
  250 | 
  
        query.sort_criteria = [['id', 'asc']] 
   | 
   | 
  251 | 
  
        totalcount_issues = query.issue_count 
   | 
   | 
  252 | 
  
    
   | 
   | 
  253 | 
  
        project = Project.find_by_identifier('subproject1')
   | 
   | 
  254 | 
  
        project.close 
   | 
   | 
  255 | 
  
        project.reload 
   | 
   | 
  256 | 
  
        totalcount_issues_without_closed_project = query.issue_count 
   | 
   | 
  257 | 
  
        display_issues = query.issues(:limit => 10) 
   | 
   | 
  258 | 
  
    
   | 
   | 
  259 | 
  
        assert_not_equal totalcount_issues_without_closed_project, totalcount_issues 
   | 
   | 
  260 | 
  
    
   | 
   | 
  261 | 
  
        get :page 
   | 
   | 
  262 | 
  
        assert_response :success 
   | 
   | 
  263 | 
  
    
   | 
   | 
  264 | 
  
        assert_select '#block-issuesreportedbyme' do 
   | 
   | 
  265 | 
  
          assert_select 'h3', :text => /[\s\S]*\(#{totalcount_issues_without_closed_project}\)\z/m
   | 
   | 
  266 | 
  
          assert_select 'table.issues' do 
   | 
   | 
  267 | 
  
            assert_select 'tr.issue', display_issues.count 
   | 
   | 
  268 | 
  
            display_issues.each_with_index do |issue, idx| 
   | 
   | 
  269 | 
  
              assert_select "tr.issue:nth-of-type(#{idx + 1})#issue-#{issue.id}"
   | 
   | 
  270 | 
  
            end 
   | 
   | 
  271 | 
  
          end 
   | 
   | 
  272 | 
  
        end 
   | 
   | 
  273 | 
  
      end 
   | 
   | 
  274 | 
  
    
   | 
  | 201 | 
  275 | 
  
      def test_page_with_activity 
   | 
  | 202 | 
  276 | 
  
        user = User.find(2) 
   | 
  | 203 | 
  277 | 
  
        user.pref.my_page_layout = {'top' => ['activity']}
   | 
  | ... | ... |  | 
  | 272 | 
  346 | 
  
              :group_ids => ['10'], 
   | 
  | 273 | 
  347 | 
  
              :custom_field_values => {
   | 
  | 274 | 
  348 | 
  
                "4" => "0100562500" 
   | 
  | 275 | 
   | 
  
              }     
   | 
  | 276 | 
   | 
  
               
   | 
   | 
  349 | 
  
              } 
   | 
   | 
  350 | 
  
    
   | 
  | 277 | 
  351 | 
  
            } 
   | 
  | 278 | 
  352 | 
  
          } 
   | 
  | 279 | 
  353 | 
  
    
   | 
  | ... | ... |  | 
  | 292 | 
  366 | 
  
        post :account, :params => {
   | 
  | 293 | 
  367 | 
  
            :user => {
   | 
  | 294 | 
  368 | 
  
              :mail => 'foobar@example.com' 
   | 
  | 295 | 
   | 
  
               
   | 
   | 
  369 | 
  
    
   | 
  | 296 | 
  370 | 
  
            } 
   | 
  | 297 | 
  371 | 
  
          } 
   | 
  | 298 | 
  372 | 
  
    
   | 
  | ... | ... |  | 
  | 419 | 
  493 | 
  
        post :update_page, :params => {
   | 
  | 420 | 
  494 | 
  
            :settings => {
   | 
  | 421 | 
  495 | 
  
              'issuesassignedtome' => {
   | 
  | 422 | 
   | 
  
              'columns' => ['subject', 'due_date']}     
   | 
   | 
  496 | 
  
              'columns' => ['subject', 'due_date']} 
   | 
  | 423 | 
  497 | 
  
            } 
   | 
  | 424 | 
  498 | 
  
          }, 
   | 
  | 425 | 
  499 | 
  
          :xhr => true 
   | 
  | ... | ... |  | 
  | 476 | 
  550 | 
  
        pref = User.find(2).pref 
   | 
  | 477 | 
  551 | 
  
        pref.my_page_layout = {'left' => ['news', 'calendar','documents']}
   | 
  | 478 | 
  552 | 
  
        pref.save! 
   | 
  | 479 | 
   | 
  
         
   | 
   | 
  553 | 
  
    
   | 
  | 480 | 
  554 | 
  
        post :order_blocks, :params => {
   | 
  | 481 | 
  555 | 
  
            :group => 'left', 
   | 
  | 482 | 
  556 | 
  
            :blocks => ['documents', 'calendar', 'news'] 
   | 
  | ... | ... |  | 
  | 490 | 
  564 | 
  
        pref = User.find(2).pref 
   | 
  | 491 | 
  565 | 
  
        pref.my_page_layout = {'left' => ['news','documents'], 'right' => ['calendar']}
   | 
  | 492 | 
  566 | 
  
        pref.save! 
   | 
  | 493 | 
   | 
  
         
   | 
   | 
  567 | 
  
    
   | 
  | 494 | 
  568 | 
  
        post :order_blocks, :params => {
   | 
  | 495 | 
  569 | 
  
            :group => 'left', 
   | 
  | 496 | 
  570 | 
  
            :blocks => ['news', 'calendar', 'documents'] 
   |